Abdullah bin Umar reported,

The Messenger of Allah ﷺ prayed one rakah with one of the two groups while the other group faced the enemy. Then they withdrew and took the position of the first group, and the first group came forward, and he prayed another rakah with them and gave the closing salaam. Then this group stood and completed their remaining rakah, and the other group stood and completed their remaining rakah.

Abu Dawud 1243

Sahih

حدثنا مسدد حدثنا يزيد بن زريع عن معمر عن الزهري عن سالم

عن ابن عمر

أن رسول الله ﷺ صلى بإحدى الطائفتين ركعة والطائفة الأخرى مواجهة العدو ثم انصرفوا فقاموا في مقام أولئك وجاء أولئك فصلى بهم ركعة أخرى ثم سلم عليهم ثم قام هؤلاء فقضوا ركعتهم وقام هؤلاء فقضوا ركعتهم

أبو داود 1243صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Prayer while traveling
Chapter
Those who said he prays one rakat with each group then gives salam, then each row stands and prays one rakat for themselves
Numbering
Darussalam 1243
Abu Dawud 1243