Praise be to Allah.
Gratitude for calamities is mustahabb, because it is more than merely accepting them.
Ibn al-Qayyim (may Allah have mercy on him) said:
With regard to the calamities that befall a person, that he has no means of warding off, such as the death of someone who is dear to him, the theft of his wealth, his own sickness, and the like, he may respond to them in four ways:
this means panicking, complaining and showing discontent. No one does that but people with the least reason, religious commitment and dignity.
2. Showing patience
either for the sake of Allah or for the sake of maintaining human dignity
3. Acceptance and contentment
this is superior to patience, although there is a difference of scholarly opinion as to whether it is obligatory or not, although the scholars are agreed that patience is a must.
this is superior to mere acceptance. In this case the individual sees the calamity as a blessing, so he gives thanks to the One Who is testing him for that test.
End quote from ‘Iddat as-Saabireen (67)
Al-Qaasimi (may Allah have mercy on him) said:
It should be noted that there is no worldly blessing but it may be a calamity for some and a blessing for others. Poverty and sickness may be good for one person, for if he were healthy and wealthy, he would become an insolent transgressor. Allah, may He be exalted, says (interpretation of the meaning):
“And if Allah were to enlarge the provision for His slaves, they would surely rebel in the earth”
“Nay! Verily, man does transgress all bounds (in disbelief and evil deed, etc.)
Because he considers himself self-sufficient”
The same may be applicable to one’s wife, children, relatives and so on. Allah, may He be exalted, did not create anything but there is wisdom and blessing in it.
So among that which Allah, may He be exalted, has created there are calamities, which may also be a blessing, either for the one who is tested thereby, or for others. Therefore there is nothing that can be described as a calamity in absolute terms, or as a blessing in absolute terms. Therefore the individual has two duties in every situation: to be patient and show gratitude.
If you say: These are opposites, so how can they be combined in one situation, because patience is only applicable in stressful situations and gratitude is only applicable in happy situations? You should understand that any one situation may be a cause of distress in one way and a source of joy in another way, so one should exercise patience with regard to that which causes distress and show gratitude for that which is a cause for joy. In every situation of poverty, sickness, fear or calamity in this world, there are five factors concerning which the wise person should rejoice and for which he should give thanks:
1. With regard to any calamity or sickness, one may think that it could be even worse, because the decree of Allah, may He be exalted, is limitless, so if Allah wanted to multiply it and increase it, what is there that could stop or prevent Him? So let the individual give thanks that it was not worse than that in this world.
2. His calamity could have been with regard to his religious commitment. According to the report: “O Allah, do not make our calamity in our religious commitment.”
3. There is no punishment but one could imagine that it could have been delayed until the hereafter, and one may find consolation in worldly calamities in many ways which would alleviate the calamity so that its impact becomes less. But in contrast, the calamity of the hereafter never ceases. So perhaps it is the case that his punishment has not been delayed until the hereafter, and has been hastened in this world, so why should he not give thanks to Allah for that?
4. This calamity and test was decreed for him in al-Lawh al-Mahfooz, so it was inevitable that it should reach him and it has done so. And now it is over and he is relieved from some or all of the calamities that were decreed for him, so it is a blessing.
5. The reward thereof is greater than the calamity itself. The calamities of this world are paths to the hereafter, and every worldly calamity is like a remedy that may cause pain in the short term, but is ultimately beneficial.
Whoever realises that, it is expected of him to give thanks for calamities, and whoever does not recognise these blessings in calamities is not expected to give thanks, because gratitude is connected to recognition of the blessing. Whoever does not believe that the reward for calamity is greater and better than the calamity itself cannot be expected to give thanks for the calamity.
Moreover, in spite of the fact that there is blessing in calamities, the Prophet (blessings in the peace of Allah be upon him) used to seek refuge with Allah in his supplication from the calamities of this world and the punishment of the hereafter, and he used to seek refuge with Allah from the rejoicing of his enemies in his misfortune, and so on. In his supplication, he (blessings and peace of Allah be upon him) said: “And Your keeping me safe and sound from calamity is dearer to me.”
End quote from Tahdheeb Maw‘izat al-Mu’mineen (287-288)
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
In their response to calamities, people fall into many ranks:
1. One who is grateful
2. One who shows acceptance and contentment
3. One who is patient
4. One who panics.
As for the one who panics, he is doing something that is prohibited and is expressing discontent with the decree of the Lord of the Worlds, in Whose hand is the sovereignty of the heavens and the earth, His is the dominion and He does whatever He wills.
As for the one who is patient, he is doing that which is obligatory. The one who is patient is the one who puts up with calamity. In other words, he finds it bitter and difficult and hard, and he dislikes it befalling him, but he puts up with it and restrains himself from saying or doing anything that is prohibited. This is what is obligatory.
As for the one who shows acceptance and contentment, he is the one who does not worry about this calamity, for he sees that it is from Allah, so he accepts it with complete acceptance and feels no sorrow or regret in his heart, because he is completely content. His situation is better than that of the one who is merely patient.
As for the one who is grateful, he gives thanks to Allah for this calamity.
But how can he give thanks to Allah for this calamity, when it is a calamity?
The answer is twofold:
Firstly, he looks at those who are afflicted with a greater calamity, and he gives thanks to Allah that he has not been afflicted with such a level of calamity.
Secondly, he realises that this calamity has befallen him as expiation for his bad deeds and to raise him in status, if he is patient, and what awaits him in the hereafter is better than what is in this world, so he gives thanks to Allah. Moreover, those who are most sorely tested among the people are Prophets, then the righteous, then the next best, then the next best. So he hopes that he is one of the righteous, and he gives thanks to Allah, may He be glorified and exalted, for this blessing.
Giving thanks for calamities is mustahabb, because it is superior to acceptance, for gratitude includes acceptance and more.
End quote from ash-Sharh al-Mumti‘ (5/395-396)
Giving thanks for calamity does not lead to further calamity, because the words of Allah, may He be exalted (interpretation of the meaning), “And (remember) when your Lord proclaimed: ‘If you give thanks, I will give you more” [Ibraaheem 14:7], only refer to giving thanks for blessings, not giving thanks for calamities, based on the fact that Allah says after that: “but if you are thankless, verily! My Punishment is indeed severe.”
As-Sa‘di (may Allah have mercy on him) said:
“And (remember) when your Lord proclaimed” that is, announced and promised
“If you give thanks, I will give you more” blessings
“but if you are thankless, verily! My Punishment is indeed severe” – and part of that is that He will take away from you the blessings that He had bestowed upon you. Giving thanks or showing gratitude means acknowledging Allah’s blessings in one’s heart, praising Allah for them, and using them in ways that please Allah, may He be exalted. Thanklessness or ingratitude for blessings is the opposite of that.
End quote from Tafseer as-Sa‘di (p. 422)
See also the answer to question no. 125984
See also the answer to question no. 146025 for information on the difference between praise and thanks.
And Allah knows best.