The Messenger of Allah ﷺ said regarding the prayer of fear that the imam should pray with one group, performing one rakah with them while another group stands between them and the enemy. Then those who prayed the rakah with their leader withdraw and take the position of those who have not yet prayed, and those who have not yet prayed come forward and pray one rakah with their leader. Their leader then concludes his prayer, having completed it, while each of the two groups prays one additional rakah on their own.If the fear is more intense than that, then they pray on foot or while riding. He said, meaning by "the sajdah," the rakah.
حدثنا محمد بن الصباح أنبأنا جرير عن عبيد الله بن عمر عن نافع
قال رسول الله ﷺ في صلاة الخوف أن يكون الإمام يصلي بطائفة معه فيسجدون سجدة واحدة وتكون طائفة منهم بينهم وبين العدو ثم ينصرف الذين سجدوا السجدة مع أميرهم ثم يكونون مكان الذين لم يصلوا ويتقدم الذين لم يصلوا فيصلوا مع أميرهم سجدة واحدة ثم ينصرف أميرهم وقد صلى صلاته ويصلي كل واحد من الطائفتين بصلاته سجدة لنفسه فإن كان خوف أشد من ذلك فرجالا أو ركبانا قال يعني بالسجدة الركعة