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.
فَإنْ خِفْتُمْ فَرِجَالاً أَوْ رُكْبَانًا
(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."
"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'.
"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.
Prayer during the Times of Peace is performed normally
فَإِذَا أَمِنتُمْ فَاذْكُرُواْ اللّهَ
And when you are in safety, then remember Allah (pray),
meaning, `Perform the prayer as I have commanded you by completing its bowing, prostration, standing, sitting, and with the required attention (in the heart) and supplication.'
كَمَا عَلَّمَكُم مَّا لَمْ تَكُونُواْ تَعْلَمُونَ
in the manner He has taught you, which you knew not (before).
meaning, just as He has endowed you, guided you and taught you about what benefits you in this life and the Hereafter, so thank and remember Him.
Similarly, Allah said after He mentioned the prayer of Fear,
فَإِذَا اطْمَأْنَنتُمْ فَأَقِيمُواْ الصَّلَوةَ إِنَّ الصَّلَوةَ كَانَتْ عَلَى الْمُوْمِنِينَ كِتَـباً مَّوْقُوتاً
but when you are free from danger, perform As-Salah. Verily, As-Salah (the prayer) is enjoined on the believers at fixed hours. (4;103)
We will mention the Hadiths about the prayer of Fear and its description in Surah An-Nisa while mentioning Allah's statement;
وَإِذَا كُنتَ فِيهِمْ فَأَقَمْتَ لَهُمُ الصَّلَوةَ
When you (O Messenger Muhammad) are among them, and lead them in As-Salah(the prayer). (4;102