The call to begin the prayer was made, so we stood and straightened the rows before the Messenger of Allah ﷺ came out to us. The Messenger of Allah ﷺ came to us, and when he stood in his place of prayer, before saying the takbir, he turned away and said to us, "Stay where you are." We remained standing, waiting for him, until he came out to us having bathed, with water dripping from his head. Then he said the takbir and led us in prayer.
أخبرنا محمد بن سلمة قال أنبأنا ابن وهب عن يونس عن ابن شهاب قال أخبرني أبو سلمة بن عبد الرحمن أنه سمع
أقيمت الصلاة فقمنا فعدلت الصفوف قبل أن يخرج إلينا رسول الله ﷺ فأتانا رسول الله ﷺ حتى إذا قام في مصلاه قبل أن يكبر فانصرف فقال لنا مكانكم فلم نزل قياما ننتظره حتى خرج إلينا قد اغتسل ينطف رأسه ماء فكبر وصلى
Muslim narrated it in [the Book of] Masjids, chapter "When should people stand up for prayer", hadith 605, from the hadith of Abdullah, and so on, hadith 275, from Ibn Wahb. Bukhari narrated it in ghusl, chapter "If he remembers while in the masjid that he is in a state of major ritual impurity", with the hadith of Yunus bin Yazid Ayli, through him. It is also found in Sunan al-Kubra, hadith 883.