Firstly: What is the Prayer of Fear?
The prayer of fear (salat al-khawf) is a prescribed prayer that is offered when Muslims are battling the enemy or protecting Muslims from them.
Secondly: The Ruling of the Prayer of Fear
The prayer of fear is legislated until the end of time. It has not been abrogated. This is by agreement of the four schools of jurisprudence, and it is the position of most scholars.
Thirdly: Effect of the Prayer of Fear on the Number of Units of Prayer
The prayer of fear has no effect on the number of units of prayer. A resident must offer the prayer to completion while a traveller may combine. It is not offered as a single unit of prayer. This is by agreement of the four schools of jurisprudence. It is the position of the Zahiri school and most scholars.
Fourthly: Manners of Offering the Prayer of Fear
All mannerisms of offering the prayer of fear that are narrated from the Prophet ﷺ are applicable.  Ibn `Uthaymin says: “One might ask: ‘What if the manners that are related from the Prophet ﷺ are not applicable at the present time because the mechanisms of war and weapons have changed?’ To this, we say: ‘If necessity entails praying during a time when one fears the enemy, then they should offer a prayer that is as close as possible to the forms related from the Prophet ﷺ when it is not possible to pray in the exact manner related from him, for Allah the Exalted says: “So fear Allah as far as you are able”. (Al-Taghabun, 16)’” (Al-Sharh al-Mumti`, 4/413) This is explicitly mentioned by Hanbalis and is a position of a group of the Salaf. It is the position of choice of al-Tabari, al-Khattabi, Ibn Hazm, al-Nawawi, Ibn Taymiyyah,  Ibn Taymiyyah says: “It is optimal to offer every act of worship that is related in multiple ways in every one of those ways, like the opening supplications of prayer, the mannerisms of offering the prayer of fear, etc.” (Al-Fatawa al-Kubra, 5/332) Ibn al-Qayyim, al-Kamal ibn al-Humam, al-Shawkani, Ibn Baz, and Ibn `Uthaymin. The first manner
The imam splits the congregation into two groups: a group facing the enemy and another group with which he offers the entire prayer, be it two, three, or four units. When he ends the prayer with salams, the group that prayed face the enemy, and the imam prays the prayer a second time with the new group. It counts as a voluntary prayer for him and an obligation for them. This is the position of the Shafi`i, Hanbali, and Zahiri schools. The second manner
All followers line up behind the imam in prayer. The row immediately behind him alone prostrates with him with the row behind them remains watching the enemy. When the imam rises for the second unit, the back row prostrates twice after he stands, then they stand, after which they move forward to the place of the first row, and the second row moves back to their position. When the imam bows, the two groups repeat what they did at first. When he sits for the tashahhud, the back row prostrates twice and catch up with him in tashahhud. He gives salams and both groups follow. This manner is mentioned by Hanafis, Shafi`is, Hanbalis, and some Malikis. It also conforms to the school of Ibn Hazm. The third manner
The imam splits them into two groups: a group facing the enemy and another that prays with him. One of the groups prays a unit of prayer with him and then goes in prayer to the place of second group. The other group takes the place of the first and prays the second unit of prayer with the imam. He then gives salams and each group makes up a unit of prayer after the imam’s salams. This is the position of the Hanafi school, the sound, well-known position of the Shafi`i school, and the Hanbali school. The fourth manner
If the enemy is not in the direction of the qiblah, the imam splits the troops into two groups: a group that guards and another that prays one unit with him and which intends to stop following him and pray another unit on its own. The group that started praying finishes their prayer with the tashahhud and salams. The other group then comes and prays the second unit with the imam. When the imam sits for the tashahhud, the followers stand and complete a second unit. The imam repeats the tashahhud. When the followers have finished their tashahhud, the imam ends their prayers with salams for they were his followers. The first group thereby attains the merit of the opening Allahu Akbar while the second group attains the merit of the closing salams. This manner is mentioned by Shafi`is and Hanbalis, and it is an old position of Malik. The fifth manner
The imam prays a four-unit prayer to completion. Each group prays two units behind him without making up the other two units. Thus, the imam’s prayer is complete while their prayer is shortened. This manner has been mentioned by Hanbalis. The sixth manner
A group stands with the imam while another group has its back to the qiblah. The imam then says the opening Allahu Akbar, and both groups do so as well. He then prays a unit with the group that is with him. He then stands and the group that was with him now face the enemy. The other group then comes, bows, and prostrates. The imam then prays with the second group. Then the group facing the enemy comes, bows, and prostrates. The imam then ends the prayer with salams while everyone is following him. This manner was mentioned by Hanbalis. The prayer of extreme fear
This method is described in the Qur’an and applies when there is extreme fear. Each individual prays in the manner he can – facing the qiblah or not, signalling for bowing and prostration in the manner he can, but ensuring the prostration is lower than bowing. Integrals that he is not able to perform are not called for in this case. This is by agreement of the four schools of jurisprudence, and it is the position of most scholars.  However, it is not permissible to fight while praying according to Hanafis. If they do so, their prayer is invalidated.
Fifthly: Conditions for the Prayer of Fear That fighting be permissible
A condition for offering the prayer of fear is that the fighting must be permissible, whether wajib – such as in the case of fighting warring non-Muslims and rebels – or permissible, like fighting those who desire to take the property of Muslims. This is by agreement of the four schools of jurisprudence. Certainty of the enemy’s arrival
A condition for offering the prayer of fear is the certainty of the enemy’s arrival. Whoever sees something approaching it thinking that it is the enemy and offers the prayer of fear, then if it turns out that it was not the enemy, he must repeat his prayer. This is the position of the majority: the Hanafis, the sound position of the Shafi`is, and Hanbalis. Dawud al-Zahiri reached the same conclusion.
Sixthly: Reasons for Offering the Prayer of Fear Fear for oneself
It is permissible to offer the prayer of fear due to any fear that a person might face, such as escaping from a flood, a fire, a predatory animal, or large snake. The majority have explicitly mentioned this: the Hanafis, Shafi`is, and Hanbalis. It is the position of Ibn Hazm. Pursuing the enemy and fearing its escape
Scholars are of two positions regarding the permissibility of offering the prayer of fear when pursuing an enemy whose escape is feared:
The first position: One who fears the escape of an enemy does not offer the prayer of extreme fear.  This is when he knows they will not return for him while he is busy with prayer, and knows that his companions are safe. As for one who fears their return or a trap, he takes the same ruling as one who is being pursued. This is the position of the Hanafi and Shafi`i schools and one narration from Ahmad. It is the position of most scholars.
The second position: One who fears the escape of an enemy may offer the prayer of fear. This is the position of the Maliki and Hanbali schools, some of the Salaf, and the chosen position of Ibn al-Qayyim. Offering the prayer of fear out of fear of missing the Day of `Arafah
Whoever fears missing `Arafah may offer the prayer of fear. This is explicitly mentioned by Hanbalis and is one position among Shafi`is. It was chosen by Ibn `Abd al-Salam, Ibn Taymiyyah, and Ibn al-Qayyim.
Seventhly: Carrying Weapons During the Prayer of Fear
Scholars are of two positions regarding carrying weapons during the prayer of fear:
The first position: It is mustahabb, but not wajib, to carry weapons during the prayer of fear. This is the position of the majority: the Hanafis, the Shafi`is according to their most apparent position, Hanbalis, and most scholars.
The second position: It is wajib to carry weapons during the prayer of fear. This is the position of the Zahiri school, one position among Shafi`is, and a position of a group of Hanbalis. Ibn al-`Arabi chose this position, Ibn Qudamah was partial to it, and Ibn `Uthaymin chose it.