Praise be to Allah, and peace and blessings be upon the Messenger of Allah.
Scholars have differed regarding the questioning of the deceased in the grave: Is it specific to the Ummah of the Prophet ﷺ, or does it also include previous nations?
Some held that the questioning in the grave is specific to this Ummah, while others withheld judgment on the matter due to the absence of an explicit text. The stronger view is that it applies to this Ummah as well as to others.
This is because the texts indicate that the trial and punishment of the grave occurred among previous nations as well. It is authentically established that the Prophet ﷺ informed us about the punishment of the Jews in their graves, and he ﷺ also used to seek refuge in Allah from the punishment of the grave.
Allah, the Exalted, says:
﴿وَإِن مِّنْ أُمَّةٍ إِلَّا خَلَا فِيهَا نَذِيرٌ﴾ [فاطر: 24]
“And there was no nation except that a warner had passed among them.” [Fatir: 24]
Just as messengers were sent to previous nations and the proof was established against them, it is possible that they were also questioned in their graves about their Lord, their religion, and their prophet, according to the evidence that had been established against them during their worldly life.
A number of scholars preferred this view, including Ibn al-Qayyim and al-Qurtubi, may Allah have mercy on them. They explained that the hadiths concerning the trial and punishment of the grave indicate that they are not exclusive to the Ummah of Muhammad ﷺ.
As for how someone who lived before the mission of the Prophet ﷺ would be questioned, the point is not that they would be asked about the Prophet Muhammad ﷺ. Rather, each person would be questioned about the prophet to whom they were sent and about the proof that had been established against them.
Therefore, the stronger view is that the questioning and trial of the grave are not specific to the Ummah of the Prophet ﷺ; rather, they also include previous nations, and Allah knows best the details of this matter.
And Allah knows best.