There is No Punishment of the Grave in the Quran
According to the Quran, there is no concept of the "punishment of the grave" that we find in various hadiths.
The whole concept of Judgement Day in the Qur'an revolves around judging whether a person deserves the eternal sentence of Hell or is eligible for the eternal bliss of the Gardens. There cannot be any punishment without first being judged. Just as in the world, we do not punish a suspect without trying him at the courts. The Day of Judgement is the day every man and woman will be judged before they are sent to their final abodes.
"Every soul shall have a taste of death: And only on the Day of Judgment shall you be paid your full recompense. Only he who is saved far from the Fire and admitted to the Garden will have been victorious: For the life of this world is nothing but the enjoyment of delusion." (Qur'an 3:185)
The Qur'an, revolving around some six thousand verses with the primary theme of Heaven and Hell, depicts no picture of a dead body being punished inside his grave prior to Judgement Day. A well versed believer in the Qur'an will certainly find this very absurd. God always makes a special point of the punishment of people who deny His path being deferred to the Hereafter after the Day of Judgement.
When you die, you return to a state of non-existence, exactly like how you were before you were born. In this state, no thoughts, memories, feelings, time, matter or space exist. Think of someone who has passed away in your life. This person has no feelings of time, thoughts, or awareness of matter or space like someone who is not yet conceived. He or she is non-existent right now. Though you are living your life, that person no longer knows there is a universe. From their last known perspective, they just breathed their last breath. In truth, they do not have a last known perspective, as from the perspective of non-existence, they never ever lived.
Before the Day of Judgment commences, the heavens and the earth will be destroyed. According to the Qur'an, the sound of a trumpet will reverberate through the earth twice. The first time it sounds, the destruction of the heavens and the earth will happen. On the second sounding of the trumpet, billions of people who have lived on earth since the beginning of humankind's existence to that day will be raised from their graves. This is the Day of Judgement (39:68-70).
During the period between your death and being raised again, there is bleak nothingness where you never existed. As stated, in this state, no time, space, matter, memories or feelings exist. God explains this state using the example of sleep by saying that waking up from sleep is 'like resurrection' (نُشُورًا - nushoora), which is the same word used for resurrection on the Last Day (see 25:40).
"And He made the night a covering for you, and sleep a rest, and He made the day a time for Resurrection (نُشُورًا - nushoora)" (Qur'an 25:47)
Death takes a person from living into a state of complete non-existence. He is re-assembled by God on the second blowing of the trumpet. To him, the moment his death occurred and the moment he woke up is a mere blink of an eye with no time in-between (therefore, even shorter than a blink), even though thousands of years may lie in-between. This is because there was no concept of time between death and Resurrection. God explains this as follows:
"All that is hidden from view in the heavens and earth belongs to God. The coming of the Hour of Judgement is like the blink of an eye, or even quicker: God has power over everything." (Qur'an 16:77)
In this bleak nothingness of death, there is no punishment at all, as nothing exists from the perspective of nothingness. Punishment is metered out once the person is judged and the verdict of Hell is declared in the manner described in the Qur'an.
The bewilderment of disbelievers raised from their graves indicates that they did not experience anything in their graves. If they were experiencing punishment in their graves, they would not be bewildered by their restored state of living. They would also not be shocked by the realization that God's path is the truth:
"The Trumpet will be blown and at once they will be rushing out from their graves towards their Lord. They will say, 'Ahh! That is it for us! Who has raised us from our sleeping-place? This is what the All-Merciful promised us. The Messengers were telling the truth.' " (Qur'an 36:51-52)
This is the true understanding of death, Hereafter, and punishment as explained by God.
"Do you have another book which you study? In it you find whatever you wish to find?" (Qur’an 68:37-38)