Praise be to Allah.
Al-Bukhaari (1197) and Muslim (827) narrated from Abu Sa’eed al-Khudri (may Allah be pleased with him) that he said: “There is no prayer after ‘Asr prayer until the sun has set and there is no prayer after Fajr prayer until the sun has risen.”
The words “There is no prayer” include all prayers, but some of the prayers are excluded on the basis of texts and others are excluded according to scholarly consensus.
Firstly: repeating the prayer in congregation, such as if a man prays Fajr in his mosque, then goes to another mosque and finds them praying Fajr, then he may pray with them, and there is no sin or prohibition on him. The evidence for that is that the Prophet (peace and blessings of Allah be upon him) prayed Fajr in Mina one day, and when he finished he saw two men who had not prayed with him, and asked them, “Why did you not pray?” They said: We prayed in our camp. He said: “If you have prayed in your camp then you come to the mosque of the congregation, then pray with them.” This was after Fajr prayer.
Secondly: When a person has done tawaaf around the Ka’bah, it is Sunnah to pray two rak’ahs after tawaaf behind Maqaam Ibraaheem. If he does tawaaf after Fajr prayer, he may pray the two rak’ahs for tawaaf. The evidence of that is the words of the Prophet (peace and blessings of Allah be upon him): “O Banu ‘Abd Manaaf, do not prevent anyone from circumambulating this House or praying here at any time they want, night or day.”
Some of the scholars quoted this verse as evidence that when a person has done tawaaf he may offer the two rak’ahs even at times when prayer is prohibited.
Thirdly: If a person enters the mosque on a Friday when the khateeb is delivering the khutbah, if that is when the sun is at its zenith, it is permissible for him to pray tahiyyat al-masjid (two rak’ahs to greet the mosque), because the Prophet (peace and blessings of Allah be upon him) was delivering the khutbah to the people when a man came in and sat down, and he said to him: “Did you pray?” He said: No. He said: “Get up and pray two rak’ahs, but make them brief.”
Fourthly: When entering the mosque. If a person enters the mosque after Fajr prayer or after ‘Asr prayer, he should not sit down until he has prayed two rak’ahs, because there is a reason for this prayer.
Fifthly: Solar eclipse. If the sun is eclipsed after ‘Asr prayer, we say: The eclipse prayer is Sunnah, so he should offer the eclipse prayer. But if we say that the eclipse prayer is obligatory, then the matter is clear, because there is no time at all when an obligatory prayer is forbidden.
Sixthly: After doing wudoo’. If a person does wudoo’, it is permissible for him to pray two rak’ahs at a time when prayer is otherwise forbidden, because there is a reason for this prayer.
Seventhly: Istikhaarah prayer. If a person wants to pray istikhaarah and ask Allah for guidance concerning a decision, he should pray two rak’ahs, then recite the du’aa’ of istikhaarah. If he is faced with a matter that he cannot delay, he may pray istikhaarah concerning it at a time when prayer is otherwise forbidden. That is permissible.
To sum up, this hadeeth (“There is no prayer after Fajr prayer and there is no prayer after ‘Asr prayer”) is specific; if a person offers a prayer for which there is a reason, then it is not prohibited.
What I have mentioned is the view of al-Shaafa’i (may Allah have mercy on him) and one of the two views narrated from Imam Ahmad, as well as being the view favoured by Ibn Taymiyah (may Allah have mercy on him) and it is the correct view, because there is no prohibition on the prayers for which there is a reason. End quote.
Shaykh Muhammad ibn ‘Uthaymeen (may Allah have mercy on him).