The Messenger of Allah ﷺ would sometimes be overtaken by dawn during Ramadan while in a state of major ritual impurity not caused by a wet dream, and he would then perform the ritual bath and fast.
و حدثني حرملة بن يحيى أخبرنا ابن وهب أخبرني يونس عن ابن شهاب عن عروة بن الزبير وأبي بكر بن عبد الرحمن أن
قد كان رسول الله ﷺ يدركه الفجر في رمضان وهو جنب من غير حلم فيغتسل ويصوم