Praise be to Allah.
Sajdat al-Shukr is prescribed for anything that makes one happy, whether it is attaining some benefit or warding off some harm. The evidence (daleel) for this is to be found in the Ahaadeeth and Aathaar (reports). Among the Ahaadeeth is the Hadeeth of Abu Bakrah (may Allah be pleased with him), who said that when the Prophet (peace and blessings of Allah be upon him) heard any news that made him glad, he would fall down prostrating to Allah, may He be exalted.
(Reported by the five except al-Nisaa’i; al-Tirmidhi said, it is hasan ghareeb). According to the version narrated by Ahmad: he saw the Prophet (peace and blessings of Allah be upon him), when news reached him that his troops had prevailed over their enemy, he was lying with his head in ‘Aa’ishah’s lap, then he got up and fell in prostration. (Reported by Ahmad, 5/45; al-Haakim, 4/291).
Another hadeeth is that narrated by ‘Abd al-Rahmaan ibn ‘Awf, who said: the Prophet (peace and blessings of Allah be upon him) went out to the place where the sadaqah (charitable donations) was kept, then he faced the Qiblah and fell in prostration, remaining like that for a long time. Then he raised his head and said, “Jibreel came to me with good news, he said, ‘Allah says to you, “Whoever sends blessings on you, I will send blessings on him, and whoever sends greetings of peace to you, I will send greetings of peace to him,”’ so I prostrated in thankfulness to Allah.”
(Narrated by Ahmad. Al-Mundhiri said: the hadeeth of Sajdat al-Shukr came from the hadeeth of al-Baraa’ with a saheeh isnaad, and from the hadeeth of Ka’b ibn Maalik and others.)
The reports include the following:
Abu Bakr (may Allah be pleased with him) prostrated when he heard the news that Musaylimah had been killed.
(Reported by Sa’eed ibn Mansoor in his Sunan).
‘Ali ibn Abi Taalib prostrated when he found Dhu’l-Thadiyah among the Khawaarij.
(Reported by Ahmad in al-Musnad)
Ka’b ibn Maalik prostrated at the time of the Prophet (peace and blessings of Allah be upon him) when he was given the glad tidings that Allah had accepted his repentance.
(The story is agreed upon)
And Allah is the source of strength. May Allah bless our Prophet Muhammad and his family and companions.