´It was narrated that Abu Hurairah said:` "The Iqamah for prayer was said and the people stood in rows, and the Messenger of Allah (ﷺ) came out. Then when he stood in the place where he prayed, he remembered that he had not performed Ghusl. He said to the people: 'Stay where you are.' Then he went back to his house, then he came out with his head dripping with water. He performed Ghusl while we were standing in our rows."
Hadith Referenceسنن نسائي / كتاب الإمامة / 793
Hadith Gradingالألبانی:صحيح | زبیر علی زئی:متفق عليه