Did the earlier Prophets know about Muhammad (blessings and peace of Allah be upon him)?
Question

I would like to know whether any of the earlier prophets were aware of any others. What I mean by that is: did Adam (peace be upon him) or the other prophets (blessings and peace of Allah be upon them) know about Muhammad (blessings and peace of Allah be upon him) before he actually came?
Praise be to Allah.With regard to Adam (peace be upon him), he knew about the Prophet (blessings and peace of Allah be upon him), as we shall see below. It is most likely that he knew about all the prophets among his descendants, as may be understood from the interpretation given by many of the early generations for the phrase {And He taught Adam the names – all of them} [al-Baqarah 2:31]. The foremost among the commentators, Ibn Jarir (may Allah have mercy on him), said: I say that the view concerning the meaning of this verse that is most likely to be correct is the view that the names that were taught to Adam were the names of prominent figures among his descendants, and the names of the angels. (End quote) Undoubtedly the prophets are the first prominent figures among the descendants of Adam whose names deserve to be mentioned. And Allah knows best.
There is a hadith which was soundly narrated from the Prophet (blessings and peace of Allah be upon him), which indicates that Adam was aware of his descendant Dawud (peace be upon him).
Imam Ahmad narrated in his Musnad, 2708, that Ibn ‘Abbas (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “The first one to make a denial was Adam” – he said it three times. “When Allah created him, He wiped his back and brought forth his progeny, then He presented them to him. He saw among them a man with a bright face, and he said: O Lord, who is this? He said: Your son Dawud. He said: How long will he live? He said: Sixty years. He said: O Lord, increase his lifespan. He said: No, not unless you increase it by giving him some of your lifespan. So he gave him forty years from his own lifespan, and Allah recorded that in a document and called the angels to bear witness. When Allah wanted to take his soul, Adam said: I still have forty years left. It was said to him: You gave them to your son Dawud. But Adam denied it. Then Allah, may He be glorified and exalted, brought out the document and established proof, then He decreed that Dawud (peace be upon him) should complete one hundred years, and He decreed that Adam (peace be upon him) should live for a thousand years.” Shaykh Ahmad Shakir said in Tahqiq al-Musnad: Its isnad is authentic. The commentators on al-Musnad said: It is sound because of corroborating evidence, apart from the words “He decreed that Dawud (peace be upon him) should complete one hundred years, and He decreed that Adam (peace be upon him) should live for a thousand years.”
As for the other prophets knowing about our Prophet Muhammad (blessings and peace of Allah be upon him), that is indicated in the verse in which Allah, may He be exalted, says:
{And [remember] when Allah took the covenant of the Prophets, saying: If I give you scripture and wisdom, and there comes to you a Messenger confirming what is with you, then you must believe in him and you must support him. [Allah] said: Do you agree, and take this covenant of Mine as binding upon you? They said: We agree. He said: Then bear witness, and I am with you among the witnesses} [Al ‘Imran 3:81].
Ibn Kathir (may Allah have mercy on him) said: ‘Ali ibn Abi Talib and his cousin ‘Abdullah ibn ‘Abbas (may Allah be pleased with them both) said: Allah never sent any of the prophets but He took a covenant from him that if He were to send Muhammad when he was still alive, he would believe in him and support him.
Then he said: The Messenger Muhammad (blessings and peace of Allah be upon him) is the last of the prophets and his message will abide until the Day of Judgement. He is the greatest leader who, if he had lived in any era, it would have been obligatory to obey him, for he takes precedence over all the prophets. Hence he led them in prayer on the night of the Isra’ (night journey) when they gathered in Bayt al-Maqdis (Jerusalem). He will also be the intercessor on the Day of Resurrection, who will go to the Lord to ask Him to pass judgement. This is the station of praise and honour (al-maqam al-mahmud) which will not be appropriate for anyone except him, and which all the Messengers of strong will will refuse until the people come to him, for he is the one who is singled out for it. (End quote)
With regard to the Prophet (blessings and peace of Allah be upon him) being aware of all the prophets, Allah, may He be exalted, says (interpretation of the meaning):
{And We have already sent messengers before you. Among them are those [whose stories] We have related to you, and among them are those [whose stories] We have not related to you} [Ghafir 40:73].
Ibn Kathir (may Allah have mercy on him) said: That is, we have revealed to you concerning some of them their stories with their people and how they disbelieved in them, then the messengers prevailed. {and among them are those [whose stories] We have not related to you} – they are many times more than those who were mentioned by name. (End quote)
But it may be said that Allah gathered them for him on the night of the Isra’ and he led them in prayer, as it is narrated in al-Bukhari and Muslim that the Prophet (blessings and peace of Allah be upon him) said: “I saw myself with a group of the prophets (blessings and peace of Allah be upon them). I saw Musa (blessings and peace of Allah be upon him) standing and praying, and I saw ‘Isa ibn Maryam (blessings and peace of Allah be upon him) standing and praying, and I saw Ibrahim (blessings and peace of Allah be upon him) standing and praying. Then the time for prayer came, so I led them in prayer.”
And it was narrated by Ahmad, 2324, from Ibn ‘Abbas (may Allah be pleased with him) that when the Prophet (blessings and peace of Allah be upon him) ended al-Masjid al-Aqsa, he stood and prayed, then he turned around and saw all the prophets praying with him. Its isnad was classed as authentic by Ibn Kathir in his Tafsir, 5/26, and by Ahmad Shakir in his commentary on al-Musnad. Al-Hafiz, in al-Fat-h, 7/209, and others quoted the words of al-Qadi ‘Iyad (may Allah have mercy on him) in ash-Shifa: The Prophet (blessings and peace of Allah be upon him) led all the prophets in prayer in Bayt al-Maqdis. Perhaps he saw them and recognized them, even though Allah did not tell him about some of them in the Quran.
And Allah knows best.