Praise be to Allah.
In the answer to question no. 131627 we spoke of the squeezing of the grave and quoted the hadeeths that have been narrated concerning that, and discussed some of the issues surrounding it. Please refer to this question.
One of the things we did not discuss there is the question that is asked here: does the squeezing in the grave affect the Prophets?
The answer to that is that there was nothing proven concerning that in the texts of Revelation, but we have come across comments of many scholars saying that the Prophets will be exempted from squeezing. This opinion is based on the view those who say that the severity of the squeezing in the grave will vary according to the individual’s level of sin. The Prophets are protected against major sins and are protected against persisting in minor sins, so they will not be affected by the squeezing or questioning in the grave.
As-Suyooti (may Allah have mercy on him) quoted a hadeeth about the grave squeezing Yahya (peace be upon him), but this hadeeth is weak and there is a problem with its isnaad. The well-known view is that the Prophets will not experience this squeezing.
End quote from Sharh as-Sudoor bi Sharh Haal al-Mawta wa’l-Quboor, p. 114
Al-Mannaawi (may Allah have mercy on him) said: The reports indicate that no one will be spared the squeezing in the grave, whether one is righteous or otherwise, but the Prophets are exempted, as was stated by the author – i.e., as-Suyooti – in al-Khasaa’is.
End quote from Fayd al-Qadeer, 5/434
He also said: But al-Hakeem – i.e., al-Hakeem al-Tirmidhi – made an exception in the case of the Prophets and awliya’ (close friends of Allah) and was of the opinion that they will not be squeezed or questioned.
My opinion is that the exemption in the case of the Prophets is obvious. With regard to the awliya’ it cannot be true. Have you not seen the high status of Sad ibn Mu‘aadh, and he was squeezed nevertheless?
End quote from Fayd al-Qadeer, 5/398
Shaykh Ahmad an-Nafraawi al-Maaliki (may Allah have mercy on him) said: With regard to the Prophets, some of them said: it is not known that the Prophets will be squeezed or questioned in their graves because they are protected from sin.
End quote from al-Fawaakih al-Dawaani, 2/688
Sulaymaan al-Bujayrimi ash-Shaafa‘i (may Allah have mercy on him) said: With regard to the squeezing of the grave, it applies to everyone who dies even if he is not accountable and no one is saved from it except the Prophets and Faatimah bint Asad.
End quote from Tuhfat al-Habeeb ‘ala Sharh al-Khateeb, 2/586
There is no proof for the exemption of Faatimah bint Qays in the Sunnah; rather the suggestion that she is exempted is based on a fabricated or very weak hadeeth that was quoted by Ibn Shabbah in his book Tareekh al-Madinah, 1/124. The isnaad of the hadeeth includes some unknown narrators, among whom is ‘Abdullah ibn Ja‘far ibn al-Miswar ibn Makhramah, of whom Ibn Hibbaan (may Allah have mercy on him) said: He made a lot of mistakes in narration and he even narrated from trustworthy narrators things that do not resemble proven hadeeths. Therefore he deserves to be rejected.
End quote from al-Majrooheen, 2/27
Shaykh ‘Abd al-‘Azeez al-Raajihi (may Allah preserve him) said: With regard to the Prophets, we do not know whether they are squeezed in their graves.
End quote from Sharh al-‘Aqeedah at-Tahhaawiyyah, p. 307
So it seems that the squeezing of the grave includes the martyrs, righteous and awliya’, but it does not include the Prophets.
And Allah knows best.