
Hazrat Azeef bin Haaris reported that he asked Hazrat Aaisha (may Allah be pleased with her) if she had seen the Prophet Muhammad (peace be upon him) performing ghusl of janabah at the beginning of the night or at the end. She replied that sometimes he did it at the beginning of the night and sometimes at the end. Hearing this, Azeef said, “All praise is for Allah who made the matter easy.”
From this hadith, Islamic scholars in the Shafi’i school understand that it is permissible to delay ghusl after janabah. However, it is better and recommended to perform ghusl as soon as possible.
Imam Ibn Hajar al-Asqalani said, “It shows that delaying ghusl from its first possible time is allowed.” (Fath al-Bari 1/56)
Imam al-‘Imrani said, “It is allowed for a person in janabah to sleep before ghusl, as reported from Aisha (RA) that the Prophet (peace be upon him) used to sleep while in janabah without touching water. But it is recommended to make wudu before sleeping.” (Al-Bayan 1/356)