Narrated ‘Amra bint ‘AbdurRahman:
A Jewess came to ask ‘Aisha (the wife of the Prophet) about something. She said to her, “May Allah give you refuge from the punishment of the grave.” So ‘Aisha ‘ asked Allah’s Apostle “Would the people be punished in their graves?” Allah’s Apostle after seeking refuge with Allah from the punishment of the grave (and thus replied in the affirmative). Then one day, Allah’s Apostle rode to go to some place but the sun eclipsed. He returned in the forenoon and passed through the rear of the dwellings (of his wives) and stood for the (eclipse) prayer, and the people stood behind him. He stood up for a long period and then performed a prolonged bowing which was shorter than the first bowing. Then he raised his head and prostrated. Then he stood up (for the second Raka) for a long while but the standing was shorter than that of the first Raka. Then he performed a prolonged bowing which was shorter than the first one. Then he raised his head and prostrated. Then he stood up for a long time but shorter than the first. Then he performed a prolonged bowing but shorter than the first. Then he raised his head and prostrated and finished the prayer and (then delivered the sermon and) said as much as Allah wished. And then he ordered the people to seek refuge with Allah from the punishment of the grave.
The punishment of the grave (` adhab al-qabr) for the unbelievers and for some of the disobedient believers is established and proven by the Qur’an, narrations that reach the level of certainty ( tawatur) and the consensus of the Ummah ( ijma`), and it is a agreed upon concept among the Ahl al-Sunnah wa al-Jama`ah. Only some members of the deviated sect Mu`tazila and the Khawarij denied the punishment of the grave.
Imaam ibn Al-Qayyim, may Allaah have mercy upon him, dedicated a full chapter in his famous book ‘Ar-Rooh’ (The soul) for this issue, and he began it by stating: “One might ask: what are the reasons behind some people being punished in the grave? There are two answers, a detailed one and a summarized one:
The summarized answer is they get punished because of their ignorance concerning Allaah, their disobedience to Him and their committing what He prohibited; Allaah will not punish a soul which knew Him, loved Him, adhered to what He commanded and refrained from what He prohibited, nor will He punish the body in which such a soul was. The punishment in the grave and in
the Hereafter is an indication of the wrath of Allaah upon His slave; The one who makes Allaah angry in this life and did not repent, and dies while in that state will be punished in the grave according to the extent he angered Allaah; some will be punished for a short while, and others for a long time.
Narrated Anas: The Prophet said, “When a human being is laid in his grave and his companions return and he even hears their footsteps, two angels come to him and make him sit and ask him: What did you use to say about this man, Muhammad ? He will say: I testify that he is Allah’s servant and His Apostle. Then it will be said to him, ‘Look at your place in the Hell-Fire. Allah has given you a place in Paradise instead of it. “The Prophet added, “The dead person will see both his places. But a non-believer or a hypocrite will say to the angels, ‘I do not know, but I used to say what the people used to say! It will be said to him, ‘Neither did you know nor did you take the guidance (by reciting the Quran).’ Then he will be hit with an iron hammer between his two ears, and he will cry and that cry will be heard by whatever approaches him except human beings and jinns.” [Bukhari]
Read more about reasons behind punishment in the grave and how to avoid it here.
More on the `aqeedah (belief) of punishment in the grave here.
Is the punishment of the grave continuous? Answer here.
Make sure to go through these links. They’ll increase your knowledge and Imaan as well. :)
Take some precaution:
From Abu Hurayrah who said: The Prophet said, “When one of you finishes the last tashahhud (testimony of faith in prayer), he should seek refuge in Allah from four things: From the Punishment of Hell, from the Punishment of the Grave, from the trials of life and death, and from the evil trials of the Maseehud-Dajjaal (Anti-Christ).”
‘O Allaah, I take refuge in You from the punishment of the grave, from the torment of the Fire, from the trials and tribulations of life and death and from the evil affliction of the Al-Maseeh Ad-Dajjaal.’