It is narrated from Sayyiduna Abu Hurayrah (may Allah be pleased with him) that the iqamah for the prayer had been called and the rows had also been straightened, when the Prophet (peace and blessings be upon him) came out to us. When he (peace and blessings be upon him) stood in his place of prayer, he (peace and blessings be upon him) remembered that he was in a state of major ritual impurity (janabah). He (peace and blessings be upon him) gestured to us and went into his house, took a ritual bath (ghusl), and came out of his house with drops falling from his (peace and blessings be upon him) head; then he (peace and blessings be upon him) led us in prayer.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4068