Did you pray in time of danger with the Messenger of Allah ﷺ? AbuHurayrah replied: Yes. Marwan then asked: When? AbuHurayrah said: On the occasion of the Battle of Najd. The Messenger of Allah ﷺ stood up to offer the afternoon prayer. One section stood with him (to pray) and the other was standing before the enemy, and their backs were towards the qiblah. The Messenger of Allah ﷺ uttered the takbir and all of them too uttered the takbir, i.e. those who were with him and those who were facing the enemy. Then the Messenger of Allah ﷺ offered one rak'ah and the section that was with him also prayed one rak'ah. He then prostrated himself and those who were with him also prostrated, while the other section was standing before the enemy. The Messenger of Allah ﷺ then stood up and the section with him also stood up. They went and faced the enemy and the section that was previously facing the enemy stepped forward. They bowed and prostrated while the Messenger of Allah ﷺ was standing in the same position. Then they stood up and the Messenger of Allah (may peace be upon) prayed another rak'ah and all of them bowed and prostrated along with him. After that the section that was standing before the enemy came forward and they bowed and prostrated, while the Messenger of Allah ﷺ remained seated and also those who were with him. The salutation then followed. The Messenger of Allah ﷺ uttered the salutation and all of them uttered it together. The Messenger of Allah ﷺ prayed two rak'ahs and each of the two sections prayed one rak'ah with him (and the other by themselves). (Using translation from Abū Dāʾūd 1240)
أَنَّهُ سَأَلَ أَبَا هُرَيْرَةَ هَلْ صَلَّيْتَ مَعَ رَسُولِ اللهِ ﷺ صَلَاةَ الْخَوْفِ؟ فَقَالَ أَبُو هُرَيْرَةَ نَعَمْ فَقَالَ مَتَى؟ قَالَ عَامَ غَزْوَةِ نَجْدٍ قَامَ رَسُولُ اللهِ ﷺ لِصَلَاةِ الْعَصْرِ وَقَامَتْ مَعَهُ طَائِفَةٌ وَطَائِفَةٌ أُخْرَى مُقَابِلَةَ الْعَدُوِّ ظُهُورُهُمْ إِلَى الْقِبْلَةِ فَكَبَّرَ رَسُولُ اللهِ ﷺ وَكَبَّرُوا جَمِيعًا الَّذِينَ مَعَهُ وَالَّذِينَ يُقَابِلُونَ الْعَدُوَّ ثُمَّ رَكَعَ رَسُولُ اللهِ ﷺ رَكْعَةً وَاحِدَةً ثُمَّ رَكَعَتْ مَعَهُ الطَّائِفَةُ الَّتِي تَلِيهِ ثُمَّ سَجَدَ وَسَجَدَتِ الطَّائِفَةُ الَّتِي تَلِيهِ وَالْآخَرُونَ قِيَامٌ مُقَابِلَةَ الْعَدُوِّ فَقَامَ رَسُولُ اللهِ ﷺ وَقَامَتِ الطَّائِفَةُ الَّتِي مَعَهُ فَذَهَبُوا إِلَى الْعَدُوِّ فَقَابَلُوهُمْ وَأَقْبَلَتِ الطَّائِفَةُ الَّتِي كَانَتْ مُقَابِلَةَ الْعَدُوِّ فَرَكَعُوا وَسَجَدُوا وَرَسُولُ اللهِ ﷺ قَائِمٌ كَمَا هُوَ ثُمَّ قَامُوا فَرَكَعَ رَسُولُ اللهِ ﷺ رَكْعَةً أُخْرَى وَرَكَعُوا مَعَهُ وَسَجَدُوا مَعَهُ ثُمَّ أَقْبَلَتِ الطَّائِفَةُ الَّتِي كَانَتْ تُقَابِلُ الْعَدُوَّ فَرَكَعُوا وَسَجَدُوا وَرَسُولُ اللهِ ﷺ قَاعِدٌ وَمَنْ تَبِعَهُ ثُمَّ كَانَ التَّسْلِيمُ فَسَلَّمَ رَسُولُ اللهِ ﷺ وَسَلَّمُوا جَمِيعًا فَكَانَتْ لِرَسُولِ اللهِ ﷺ رَكْعَتَانِ وَلِكُلِّ رَجُلٍ مِنَ الطَّائِفَتَيْنِرَكْعَتَانِ رَكْعَتَانِ