(And surely, We shall try you till We test those who strive hard (for the cause of Allah) and As-Sabirin (the patient), and We shall test your facts (i.e., the one who is a liar, and the one who is truthful).) (47:31)
Hence, He tests them with the bounty sometimes and sometimes with the afflictions of fear and hunger. Allah said in another Ayah:
فَأَذَاقَهَا اللَّهُ لِبَاسَ الْجُوعِ وَالْخَوْفِ
(So Allah made it taste extreme of hunger (famine) and fear.) (16:112)
The nature and the significance of the severe test man is put to by Allah has been thoroughly discussed while explaining the verse’ وَإِذِ ابْتَلَىٰ إِبْرَاهِيمَ رَبُّهُ 'And when his Lord put Ibrahim to a test'.
Whatever their magnitude, accidents are unnerving. But a prior knowledge of such accidents makes it easier to bear them and be patient about them. Since the entire Ummah is addressed here, the Ummah should realize that the world is a place of hardships and labour; it is a place of ordeal. It will not, therefore, amount to impatience if one does regard such accidents as either strange or a remote chance. And as the Ummah, generally, displays the spirit of patience in all its deeds, the reward of Mercy is common to everyone who strives to be patient. But as the quality and degree of patience varies from person to person, everyone will be rewarded individually according to and commensurate with his quality of patience.
A formula of peace in hardship
That the patient people used to recite: إِنَّا لِلَّـهِ وَإِنَّا إِلَيْهِ رَاجِعُونَ : 'We belong to Allah and to Him we are to return' is, in fact, an inculcation of the principle of virtue. The suggestion is that this is what the patient people should say as it brings excellent reward, relieves from the burden of sorrow and suffering and consoles effectively the grieved heart.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 156–157
On the death of a loved one, one goes in a state of prayerfulness, deep thinking and contemplation. The experience reminds him that there is very little time at his disposal and that at any moment death can come calling. However, we are so involved in worldly things that we never stop to think about the day which is fast approaching us. The Prophet Muhammad said, ‘People are asleep, they will wake up only when they die.’ All of a sudden, death will bring you standing face to face with God, at which time you will be held accountable for all your deeds. That will be the moment you realise that what you were doing was one thing and that what you should have been doing was quite another. The Prophet Muhammad once said that on the Day of Judgement, a man’s foot would not move unless he had answered four questions: Where he earned his money from, and where he spent it; how he spent his youth and how he used his knowledge. The Creator has divided human life into two parts: the pre-death and post-death periods. The pre-death period is very short (like the tip of an iceberg) in comparison to the post-death period, which is eternal. The pre-death period is the preparatory phase in which you prepare yourself to become eligible to enter Paradise in the post-death period. This worldly life is a ‘test’ for everyone, whether poor or rich, powerful or powerless, strong or weak. Man is required to pass in all these tests and trials by leading a need-based life rather than a desire and greed-based life, so that in the life hereafter, God will allow him to enter Paradise, to live there forever in close proximity to his Creator. On the death of a loved one, one should not go into a state of mourning. The Quran gives us great hope in moments of grief and loss: It says that God will reunite all the righteous members of the family in Paradise. Moreover, if a member of the family has reached a higher level of Paradise, all the righteous members of that family will be ‘upgraded’, so that they may all enjoy eternal bliss and nearness to God. This idea gives great solace and it acts as an incentive and encouragement to do good work, and lead a pious and righteous life. The Prophet Muhammad said that when a man dies, everything connected with him is cut off except three things: Continuous charity, knowledge from which benefit is derived and virtuous children who pray for him.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.