Mishkat al-Masabih 1009
عَنْ أَبِي هُرَيْرَةَ أَنَّ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ خَرَجَ إِلَى الصَّلَاةِ فَلَمَّا كَبَّرَ انْصَرَفَ وَأَوْمَأَ إِلَيْهِمْ أَنْ كَمَا كُنْتُمْ. ثُمَّ خَرَجَ فَاغْتَسَلَ ثُمَّ جَاءَ وَرَأَسُهُ يَقْطُرُ فَصَلَّى بِهِمْ. فَلَمَّا صَلَّى قَالَ: «إِنِّي كُنْتُ جُنُبًا فنسيت أَن أَغْتَسِل» . رَوَاهُ أَحْمد
From Abu Hurayrah: The Prophet ﷺ came out to the prayer, and when he had said the takbir he left, gesturing to them to [stay] as they were. Then he went out and performed ghusl, then came with his head dripping and led them in prayer. When he had prayed, he said: "I was in a state of janabah and forgot to perform ghusl." Reported by Ahmad.