﴿فَإنْ خِفْتُمْ فَرِجَالاً أَوْ رُكْبَانًا فَإِذَآ أَمِنتُمْ فَاذْكُرُواْ اللَّهَ كَمَا عَلَّمَكُم مَّا لَمْ تَكُونُواْ تَعْلَمُونَ ﴾
(And if you fear (an enemy), (perform Salah) on foot or riding. And when you are in safety, then remember Allah (pray) in the manner He has taught you, which you knew not (before).)
After Allah commanded His servants to perform the prayer perfectly and emphasized this commandment, He mentioned the situation where the person might not be able to perform the prayer perfectly, during battle and combat. Allah said:
﴿فَإنْ خِفْتُمْ فَرِجَالاً أَوْ رُكْبَانًا﴾
(And if you fear (an enemy), perform Salah on foot or riding.) meaning, pray in the appropriate manner under these circumstances, whether on foot or riding and whether facing the Qiblah or otherwise. Imam Malik reported that Nafi` related that Ibn `Umar used to describe the Fear prayer when he was asked about it and would then add, "If there is intense fear, pray on foot, riding, facing the Qiblah and otherwise.'' Nafi` commented, "I think that he related that to the Prophet .'' Al-Bukhari and Muslim reported the Hadith.
Muslim, Abu Dawud, An-Nasa'i, Ibn Majah and Ibn Jarir reported that Ibn `Abbas said, "Allah has ordained the prayer by the words of your Prophet : four (Rak`ah) while residing, two Rak`ah while traveling and one Rak`ah during times of fear.'' This is also the view of Al-Hasan Al-Basri, Qatadah, Ad-Dahhak, and others.
In addition, Al-Bukhari has entitled a Chapter: `Prayer while confronting the Forts and facing the Enemy'. Al-Awza`i said, "If the victory seems near and the Muslims are unable to perform the prayer (in the normal manner), they should pray by nodding each by himself. If they are unable to nod, they should delay the prayer until fighting is finished. When they feel safe, they should pray two Rak`ah. If they are unable, they should then pray one Rak`ah that includes two prostrations. If they are unable, then Takbir alone does not suffice, so they should delay the prayer until they are safe.'' This is the same view that Makhul held. Anas bin Malik said, "I participated in the attack on the fort of Tastar, when the light of dawn started to become clear. Suddenly, the fighting raged and the Muslims were unable to pray until the light of day spread. We then prayed (the Dawn prayer) with Abu Musa and we became victorious. I would not have been pleased if I were to gain in the life of this world and whatever is in it instead of that prayer.'' This is the wording of Al-Bukhari.