The Messenger of Allah ﷺ performed the prayer of fear on one of his days. One group stood with him while another faced the enemy. He prayed one rakah with those who were with him, then they went off and the others came, and he prayed one rakah with them. Then each of the two groups made up the remaining rakah on their own.Ibn Umar said, "If the danger is greater than that, then pray while riding or standing, gesturing with your head."
و حدثنا أبو بكر بن أبي شيبة حدثنا يحيى بن آدم عن سفيان عن موسى بن عقبة عن نافع
صلى رسول الله ﷺ صلاة الخوف في بعض أيامه فقامت طائفة معه وطائفة بإزاء العدو فصلى بالذين معه ركعة ثم ذهبوا وجاء الآخرون فصلى بهم ركعة ثم قضت الطائفتان ركعة ركعة قال وقال ابن عمر فإذا كان خوف أكثر من ذلك فصل راكبا أو قائما تومئ إيماء