The Prophet (ﷺ) prostrated in Sad and said: "Dawud did this prostration in repentance and we do it in thanksgiving."
Sunan an-Nasa'i Book 11, Hadith 82