Anas bin Malik (May Allah be pleased with him) narrated that the Messenger of Allah (Peace and Blessings of Allah be upon him) said, “Let none amongst you wish for death because of a hardship that afflicted him. If, at all, he has a reason to do so, let him say: ‘O Allah! Keep me alive as long as my remaining alive is better for me; and make me die as long as my being dead is better for me.”
Some scholars say,
“Death is not a complete inexistence or disappearance. Rather, it is separation of the soul from the body, change of situation and movement from one abode to another. Death is one of the greatest calamities.
Allah calls it so when He says,
ۚ فَأَصَابَتْكُمْ مُصِيبَةُ الْمَوْتِ
“And death befalls on you.”
It is, indeed, a great calamity, but according to the scholars, it is a greater calamity to be forgetful about it, to turn away whenever it is mentioned, and to not think of it or work towards it. Death alone is enough an admonition for someone who wants to learn. It is enough a thought for a person who wants to think. (he only situation in which a person can wish for death is when one fears that he may lose his religion, and at the appearance of turmoil.