It was the practice of the Prophet (peace and blessings be upon him):
"Dawn would sometimes come upon he (peace and blessings be upon him) while he was in a state of major ritual impurity (janabah) because of his wife; then he would take a ritual bath (ghusl) and fast."
Hadith Referenceصحیح الجامع الصغیر / حرف الكاف / 4938