The majority of the scholars say that it is preferred to make
prostrations of thankfulness (shukr) when one receives a bounty or is
rescued from some trial. Abu Bakr reports that, when the Prophet
sallallahu alehi wasallam received something which pleased him or some
glad tidings, he would make the sajdah in thanks to Allah. This is
related by Abu Dawud, Ibn Majah, and at-Tirmizhi who says it is hasan.
And al-Baihaqi records, with a chain that meets al-Bukhari's
conditions, that when 'Ali wrote to the Messenger of Allah, informing
him that Hamazhan had embraced Islam, the Prophet prostrated, and when
he raised his head, he said: "Peace be upon Hamazhan, peace be upon
Hamazhan."
'Abdurrahman ibn 'Auf relates that the Messenger of Allah went out
once and he followed him until he entered a grove of palm trees and
prostrated. His prostration was so long that 'Abdurrahman feared that
Allah had taken his soul. 'Abdurrahman came to look at him and he
raised his head and said: "What is wrong, Abdurrahman'?" Abdurrahman
mentioned what had happened, and he said: "Gabriel alehi as-salam came
to me and said: 'Shall I not give you glad tidings'? Allah says to you,
Whoever prays upon you, I pray upon him. Whoever salutes you, I salute
him.' Therefore, I prostrated to Allah in thanks." This is related by
Ahmad and by AlHakim who says: "It is sahih according to the criterion
of al-Bukhari and Muslim. And I do not know anything more authentic
than that."
Al-Bukhari records that Ka'b ibn Malik made a sajdah when he
received the news that Allah had accepted his repentance. Ahmad records
that 'Ali performed the sajdah when he heard the news that
Zhul-Thudayyah of the Khawarij was killed. Also, as mentioned before,
Sa'id ibn Mansur recorded that Abu Bakr made sajdah in thankfulness
when Musailimah was killed.
The prostration of thankfulness is bound by the same requirements as
the prostration in prayer, while some disagree as it is not a prayer.
The author of Fath al-'Alam remarks: "This latter opinion is closer to
being correct." Ash-Shaukani said: "There is nothing in the hadith to
prove that ablution and purity of the clothes and place are required
for sajdat-ushshukr. And that is the opinion of Imam Yahya and Abu
Talib. And these hadith are silent about any takbir being made with the
prostration. In alBahr it is stated that there is a takbir. Imam Yahya
says: 'One is not to make the prostration of thankfulness during a
prayer as it is not part of the prayer.'"