Shaykh al-Islam Ibn Taymiyah said: “Prayers which are done for a reason, such as the prostration of recitation, greeting the mosque, the eclipse prayer, prayer immediately after purifying oneself, as mentioned in the hadeeth of Bilaal, and istikhaarah prayer should not be delayed if the reason comes up at a time when prayer is disallowed, because delaying them may cause one to miss them, such as if the one who is praying istikhaarah may miss the thing concerning which he is seeking guidance if he delays the prayer. The same applies to the prayer of repentance. If a person commits a sin, then it is obligatory to repent straight away, and it is recommended for him to pray two rak’ahs, then repent, as it says in the hadeeth of Abu Bakr al-Siddeeq.”
Majmoo’ al-Fataawa (23/215).