Answered by Shaykh Yūsuf Badāt
Question:
Is there such thing as ṣalāh (ritual prayer) for need, and ṣalāh for repentance? Did the Prophet (peace and blessings upon him) ever do or encourage this?
Answer:
In the Name of God, Most Merciful, Most Compassionate
Jazāk Allāh Khayr/ Thank you for your question.
May God bless you greatly for your interest in religious matters. May He bless us all with the ability to follow that which was demonstrated to us by the Prophet Mohammed (peace and blessings upon him).
The following narrations, amongst others, point out the prophetic example regarding the ṣalāt al-Ḥājah (prayer for necessity) and ṣalāt al-Taubah (prayer for repentance):
Hudhayfah (may God be pleased with him) reports, “Whenever a matter (of concern) would befall the Messenger of God, he would perform ṣalāh.” (Musnad Aḥmad, Abū Dawūd)
Abu Bakr (may God be pleased with him) narrated, “I heard the Messenger of God (peace and blessings upon him) saying, “Any person who commits a sin, thereafter gets up and washes (performs ablution), following which they performs ṣalāh, seeks forgiveness from God, the Almighty forgives them.” The Prophet (peace and blessings upon him) then recited this verse (Qurʾān 3:135) “Those who, when they happen to commit a shameful act or wrong themselves, remember God, then seek forgiveness for their sins; and who is there to forgive sins except God?, and they do not persist in what they have done, knowingly.” (Tirmidhī, Abū Dāwūd, Nasaīʾ, Ibn Mājah, Ibn Ḥibbān, Bayhaqī)
And Allāh Knows Best