Praise be to Allah. 

Shaykh Muhammad ibn ‘Uthaymeen (may Allah have mercy on him) said:

The torment of the grave is one of the matters of the unseen. How many people in these graves are being tormented but we do not realize it, and how many of their neighbours are being blessed with a door opened for them to Paradise, but we do not realize it? What is beneath the graves is known only to the Knower of the Unseen. The torment of the grave is one of the matters of the unseen, and were it not for the revelation that came to the Prophet (peace and blessings of Allah be upon him), we would not know anything about it. Hence when the Jewish woman entered upon ‘Aa’ishah and told her that the dead are tormented in the grave, she was alarmed, until the Prophet (peace and blessings of Allah be upon him) came and she told him, and he confirmed that. But Allah may cause whomsoever He wills of His slaves to see that, as He caused His Prophet (peace and blessings of Allah be upon him) to see the two men who were being punished, one for going about spreading malicious gossip, and the other for not taking precautions to protect himself from urine.

The reasons why this is one of the matters of the unseen are as follows:

1 – Allah is the Most Merciful of those who show mercy, for if we were to see the torment of the grave this would make our lives a misery, because if a person were to know that his father or brother or son or spouse or relative is being punished in the grave and he is not able to save him, then he would be distressed and unable to relax. So this is a blessing from Allah. 

2 – It would be a scandal for the deceased. If Allah had concealed him and we did not know his sins, which were a matter between him and his Lord, then he died and Allah showed us his torment, that would be a great scandal for him. So concealing him is a mercy from Allah towards the deceased.

3 – It might become difficult to bury the dead, as it was narrated that the Prophet (peace and blessings of Allah be upon him) said: “Were it not that you would not bury one another, I would have asked Allah to make you hear the torment of the grave.” Narrated by Muslim, 2868.

This indicates that burial might become too difficult and people would not do it, even though if a person deserves to be punished he will be punished even if he is lying on the surface of the earth. But people might imagine that the torment only takes place when the person is buried, so they would not bury one another.

4 – If it were visible, belief in it would serve no purpose, because it would be visible and no one could deny it. And this might force all people to believe, as Allah says (interpretation of the meaning):

“So when they saw Our punishment, they said: We believe in Allah Alone”

[Ghaafir 40:84]

So if the people saw those who had been buried and heard their screams, they would believe and none of them would disbelieve, because he would be certain that the torment is real and he would see it with his own eyes as if it were happening to him.

But the wisdom of Allah is great, and the true believer is the one who believes with certainty what Allah tells him more than what he sees with his own eyes, because what Allah tells us cannot be subject to confusion or lies, but what the eyes see may be imaginary. How many people have sworn that they have seen the new crescent moon, when it was in fact a star; how many people have seen the new moon and it turned out to be a white hair on his eyebrow; how many have seen a shadow and said that it was a person coming towards him, but it turned out to be the trunk of a palm tree; how many people have seen a stationery object moving and a moving object standing still. But what Allah tells us cannot be subject to confusion. 

We ask Allah to make us and you steadfast, for what Allah tells us about these matters is stronger that what we can see, and concealment is in the best interests of people.

And Allah knows best.

(Source - Islam Q&A)