Regarding the prayer of fear, he said that the imam stands facing the qiblah with one group of the people behind him, while another group stands facing the enemy. The imam leads the first group in one rakah, then they complete a rakah on their own and perform two prostrations by themselves where they stand. They then move to take the position of the other group, and the other group comes forward. The imam leads them in one rakah and two prostrations, so he has prayed two rakahs while they have prayed only one. They then complete one rakah and two prostrations on their own.
حدثنا محمد بن بشار حدثنا يحيى بن سعيد القطان حدثنا يحيى بن سعيد الأنصاري عن القاسم بن محمد عن صالح بن خوات بن جبير
أنه قال في صلاة الخوف قال يقوم الإمام مستقبل القبلة وتقوم طائفة منهم معه وطائفة من قبل العدو ووجوههم إلى العدو فيركع بهم ركعة ويركعون لأنفسهم ويسجدون لأنفسهم سجدتين في مكانهم ثم يذهبون إلى مقام أولئك ويجيء أولئك فيركع بهم ركعة ويسجد بهم سجدتين فهي له ثنتان ولهم واحدة ثم يركعون ركعة ويسجدون سجدتين
Agreed upon [by Bukhari and Muslim]. Bukhari narrated it in the Book of Military Expeditions, chapter on the Expedition of Dhat al-Riqa, hadith no. 4131, from the hadith of Yahya Qattan, and Muslim, hadith no. 841, from the hadith of Qasim bin Muhammad, with the same wording.