So the Exalted said:
“Say, ‘I am no novelty among the messengers, nor do I know what will be done with me or with you.’” [al-Ahqaf 9]
In other words: I am not the first person ever sent, nor the first to claim messengership; many messengers came before me.
“And I do not know what will be done with me or with you. I only follow what is revealed to me, and I am nothing but a clear warner.” [al-Ahqaf 9]
That is, I lay no claim to knowledge of the unseen. I follow only what is revealed to me, and I am but a manifest warner who cautions you with what Allah has ordered me to convey. I do not say that I possess the treasuries of Allah, that I know the unseen, or that I am an angel. Such words display the perfection of his truthfulness, fairness, servitude to Allah, obedience to Him, and his clear distinction between what belongs solely to the Creator and what befits the servant. Detailed knowledge of how matters will end is knowledge Allah has reserved for Himself; not even a close angel or a commissioned prophet possesses it.
Therefore, it is not a prerequisite for a messenger to know everything that will occur. His—Exalted is He—statement, “And I do not know what will be done with me or with you” [al-Ahqaf 9], negates his knowing every single thing that will happen to him or to them; only Allah knows that.