The punishment in the grave may happen to sinners among those who affirm the Oneness of Allah; the squeezing in the grave will happen to everyone
Praise be to Allah.
There is no contradiction, praise be to Allah, between the texts that speak of the punishment and blessing in the grave; all of them are true. What has been narrated about the grave of the believer being widened seventy cubits by seventy and illuminated for him, and its being said to him, “Sleep like the bridegroom who will not be wakened except by the dearest of his family to him,” and it being filled with green for him – as was narrated by at-Tirmidhi (1071) and others, and classed as hasan by al-Albaani in Mishkaat al-Masaabeeh – this has to do with the perfect believer who would hasten to obey Allah and would be slow to disobey Allah, or is one of those for whom Allah, may He be glorified and exalted, decrees salvation from the punishment and trial of the grave, such as the martyrs.
With regard to what was narrated about the punishment of some Muslims in their graves, this applies to the sinners who mixed righteous deeds with bad deeds. Allah may punish them in their graves for their sins, and in the Fire on the Day of Resurrection until, when they have been cleansed and purified, He will grant permission for them to enter Paradise, as is proven in Saheeh al-Bukhaari, 7047, from the hadeeth of Samurah ibn Jundub (may Allah be pleased with him), that the punishment of the grave will be for many of the sinners among those who affirmed the Oneness of Allah, such as those who slept and missed obligatory prayers, or those who committed zina, consumed riba (usury) and liars whose lies spread far and wide.
Al-Haafiz Ibn Hajar said:
This indicates that some sinners will be punished in al-barzakh.
End quote from Fath al-Baari, 12/445
The punishment in the grave is also proven for the one who does not take precautions to avoid his urine (getting on his clothes and body) and the one who goes about spreading malicious gossip among people, as it says in al-Bukhaari, 216; and Muslim, 292.
Ibn al-Qayyim (may Allah have mercy on him) said:
The punishment in the grave is of two types: one type that is ongoing, apart from that which is narrated in some hadeeths about it being reduced for them in the period between the two trumpet blasts, then when they rise from their graves they will say: ‘Woe to us, who has raised us up from our resting place?’. The fact that it will be ongoing is indicated by the verse in which Allah, may He be exalted, says (interpretation of the meaning): “The Fire; they are exposed to it, morning and afternoon” [Ghaafir 40:46].
The second type will last for a while and then cease. This is the punishment of some sinners whose sins were minor. They will be punished according to their sins, then it will be reduced, as they will be punished in the Fire for a while, then the punishment will cease. The punishment may be stopped for them by virtue of supplication (du‘aa’), charity, prayers for forgiveness or the reward for Hajj (if these actions are performed by relatives or others after their death).
End quote from ar-Rooh, p. 89
For information on some forms of punishment in the grave, please see the answer to question no. 8829
There is a difference between the punishment in the grave that will affect the sinners and that with which the believer will be tested in his grave of squeezing and the questions of the two angels. This is not a punishment; the fear and dread of the grave, and the squeezing, are things that will happen to everyone;, even the righteous among the believers will experience some of that.
With regard to punishment in a specific sense, this is what we referred to in the first paragraph of this answer; it is a punishment for specific things, and is not something general that applies to everyone.
As-Suyooti (may Allah have mercy on him) said in his commentary on an-Nasaa’i (4/103):
An-Nasafi said: The obedient believer will not have any punishment in the grave, but he will experience the squeezing of the grave. End quote.
This is explained further by the report narrated by Ahmad (23762) from ‘Aa’ishah, from the Prophet (blessings and peace of Allah be upon him) who said: “There is squeezing in the grave and if anyone were to be saved from it, Sa‘d ibn Mu‘aadh would have been saved from it.”
Claased as saheeh by al-Albaani in as-Saheehah, 1695
This squeezing is the first thing experienced by the deceased when he is placed in his grave; it is not part of the punishment of the grave which will happen to the sinners among the Muslims, based on the fact that it happened to Sa‘d ibn Mu‘aadh (may Allah be pleased with him) at whose death the Throne of the Most Merciful shook, as is proven in al-Bukhaari, 3803; and Muslim, 2466
The words of the questioner, “each cubit is one foot six inches”, concerning the length of the cubit mentioned in the hadeeth, “his grave will be widened for him seventy cubits” is something for which there is no evidence, because the life of al-barzakh is part of the unseen that we believe in, but we cannot measure it by worldly standards. We believe that the grave of the believer will be widened for him seventy cubits, but we do not speak about the length of these cubits, because that is part of the unseen. The hadeeth of al-Bara’ that was narrated by Imam Ahmad (18063) concerning that says: “his grave will be widened for him as far as his eye can see.” Classed as saheeh by al-Albaani in Saheeh al-Jaami‘, 1676.
And Allah knows best.