Praise be to Allaah.
In the answer to questions no. 306, 8818, and 20013, we have stated the times at which the Prophet (peace and blessings of Allaah be upon him) forbade prayer. What is meant by this forbidding is general naafil prayers for which there is no reason. As for naafil prayers for which there is a reason, such as greeting the mosque, they may be offered at these times when prayer is not allowed.
The scholars differed concerning istikhaarah prayer and whether it is regarded as a prayer for which there is a reason, or not.
The correct view is that if istikhaarah is done for something that is immediate and cannot be delayed, then this prayer may be performed at a time when prayer is not allowed, such as if a person wants to travel after âAsr prayer. But if the matter is not immediate and the prayer can be delayed until after the time when prayer is not allowed is over, then it should not be performed at that time.
Shaykh al-Islam Ibn Taymiyah said in al-Fataawa al-Kubra (5/345):
Regular Sunnah prayers may be made up, and prayers for which there is a reason may be done during the times when prayer is not allowed. This is one of the two views narrated from Ahmad, and is the view favoured by a number of our companions and others. Istikhaarah prayer may be performed at the time when prayer is not allowed with regard to something that is immediate and cannot be delayed until the time when prayer is permitted.
It is mustahabb to offer two rakâahs immediately after doing wudooâ, even if that is at a time when prayer is not allowed. This is the view of al-Shaafaâi. End quote.
Shaykh Ibn âUthaymeen (may Allaah have mercy on him) was asked: Can a person pray istikhaarah at a time when prayer is not allowed?
If istikhaarah has to do with an immediate matter that cannot be delayed until the time when prayer is not allowed is over, then it may be done. If it is for something that may be delayed, then it must be delayed. End quote.
Majmooâ Fataawa Ibn âUthaymeen, 14/275.