Salim reported that Abdullah bin Umar said, "I went on a military campaign with the Messenger of Allah ﷺ toward Najd. We faced the enemy and drew up our ranks against them. The Messenger of Allah ﷺ stood to lead us in prayer. One group stood with him to pray, while another group faced the enemy. The Messenger of Allah ﷺ performed one bowing with those who were with him and two prostrations, then he gave the closing salutation. After that, each man stood and performed one bowing for himself and two prostrations."
أخبرني سالم أن عبد الله بن عمر قال: غزوت مع رسول الله ﷺ قبل نجد فوازينا العدو فصاففنا لهم، فقام رسول الله ﷺ يصلي لنا، فقامت طائفة معه تصلي، وأقبلت طائفة على العدو، وركع رسول الله ﷺ بمن معه، وسجد سجدتين، ثم سلم. فقام كل واحد منهم فركع لنفسه ركعة، وسجد سجدتين.
Bukhari narrated it in "Fear" (942) and in "Military Expeditions" (4133), and Muslim in "Travelers' Prayer" (839), both from the hadith of Zuhri, and the wording is Bukhari's. Muslim did not mention that this took place during a military expedition before Najd.