How can a group of soldiers offer Salat-ul-Khawf (Prayer in times of fear),
and how can it be offered by an individual soldier who is sent on a military mission and is afraid of encountering the enemy?
There are different ways of offering Salat-ul-Khawf according to the different situations the soldiers may be in and their position in relation to their enemy. Allah mentions two ways of offering Salat-ul-Khawf in the Qur’an. The first is in Surah Al-Baqarah where Allah (Exalted be He) says:
Guard strictly (five obligatory) As-Salawât (the prayers) especially the middle Salât (i.e. the best prayer - ‘Asr ). And stand before Allâh with obedience [and do not speak to others during the Salât (prayers)].
And if you fear (an enemy), perform Salât (pray) on foot or riding. And when you are in safety, offer the Salât (prayer) in the manner He has taught you, which you knew not (before).
The second is in Surah Al-Nisa' where Allah (Exalted be He) says,
When you (O Messenger Muhammad صلى الله عليه وسلم) are among them, and lead them in As-Salât (the prayer), let one party of them stand up [in Salât (prayer)] with you taking their arms with them; when they finish their prostrations, let them take their positions in the rear and let the other party come up which have not yet prayed, and let them pray with you taking all the precautions and bearing arms. Those who disbelieve wish, if you were negligent of your arms and your baggage, to attack you in a single rush
There are also Sahih (authentic) Hadith that show other ways of offering Salat-ul-Khawf. You should read the explanation of these Ayahs (Qur'anic verses), the Sahih Hadith, (Part No. 8; Page No. 175) and the scholars' views on this subject, to learn the different ways of performing it.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.