Short answer
You can delay ghusl until there is just enough time left to do it and pray the next prayer on time. You may sleep, eat and go out in janabah, and it is better to make wudu first. A fast is valid if you wake up in janabah and do ghusl after suhoor. The four schools agree.
Ghusl from janabah becomes urgent only when a prayer is due: delaying it until a prayer is missed is a sin. Sleeping or eating while junub is permitted, and making wudu (or at least washing the private parts, hands and mouth) beforehand is mustahabb. Being junub at dawn does not affect the fast.
The four schools agree on this.
Explanation
Janabah is not a state you must leave the moment it begins. Umar asked the Prophet ﷺ whether one of them could sleep while junub, and he said yes, once he has made wudu. Aisha and Umm Salamah reported that dawn sometimes came while he was junub from intimacy, and he did ghusl and fasted. All four schools agree on this.
What it means in practice:
- At night: you can sleep and do ghusl before Fajr. Make wudu before sleeping if you can.
- During the day: you can go out, work and run errands, then do ghusl before the next prayer.
- The limit: once a prayer time is running out, ghusl becomes urgent. Missing a prayer because you put off ghusl is sinful.
- Without need, it is better not to stay junub for long, so that you are ready to pray, recite and enter the masjid.
Ramadan and other fasts:
- Waking up junub, or having a wet dream during the day, does not break the fast.
- You can eat suhoor first and then do ghusl, before or after the Fajr adhan, as long as you pray Fajr on time.
- While fasting, rinse your mouth and nose without gargling or sniffing water deep, so that no water goes down your throat.
- There is no ghusl required before Ramadan begins.
A woman whose period ends at night follows a similar rule: see fasting before ghusl after a period.
What you cannot do until you bathe is listed in what is janabah.
The evidence
Quran, Surah Al-Baqara 2:187
أُحِلَّ لَكُمْ لَيْلَةَ ٱلصِّيَامِ ٱلرَّفَثُ إِلَىٰ نِسَآئِكُمْ ۚ هُنَّ لِبَاسٌۭ لَّكُمْ وَأَنتُمْ لِبَاسٌۭ لَّهُنَّ ۗ عَلِمَ ٱللَّهُ أَنَّكُمْ كُنتُمْ تَخْتَانُونَ أَنفُسَكُمْ فَتَابَ عَلَيْكُمْ وَعَفَا عَنكُمْ ۖ فَٱلْـَٰٔنَ بَٰشِرُوهُنَّ وَٱبْتَغُوا۟ مَا كَتَبَ ٱللَّهُ لَكُمْ ۚ وَكُلُوا۟ وَٱشْرَبُوا۟ حَتَّىٰ يَتَبَيَّنَ لَكُمُ ٱلْخَيْطُ ٱلْأَبْيَضُ مِنَ ٱلْخَيْطِ ٱلْأَسْوَدِ مِنَ ٱلْفَجْرِ ۖ ثُمَّ أَتِمُّوا۟ ٱلصِّيَامَ إِلَى ٱلَّيْلِ ۚ وَلَا تُبَٰشِرُوهُنَّ وَأَنتُمْ عَٰكِفُونَ فِى ٱلْمَسَٰجِدِ ۗ تِلْكَ حُدُودُ ٱللَّهِ فَلَا تَقْرَبُوهَا ۗ كَذَٰلِكَ يُبَيِّنُ ٱللَّهُ ءَايَٰتِهِۦ لِلنَّاسِ لَعَلَّهُمْ يَتَّقُونَ ﴿١٨٧﴾
It has been made permissible for you the night preceding fasting to go to your wives [for sexual relations]. They are clothing for you and you are clothing for them. Allah knows that you used to deceive yourselves, so He accepted your repentance and forgave you. So now, have relations with them and seek that which Allah has decreed for you. And eat and drink until the white thread of dawn becomes distinct to you from the black thread [of night]. Then complete the fast until the sunset. And do not have relations with them as long as you are staying for worship in the mosques. These are the limits [set by] Allah, so do not approach them. Thus does Allah make clear His ordinances to the people that they may become righteous.
Intimacy is allowed until dawn, so starting a fast in janabah must be valid.
Sahih al-Bukhari 287
Sahih... أيرقد أحدنا وهو جنب قال نعم إذا توضأ ...
"Can one of us sleep while junub? He said: Yes, if he has made wudu."
Ghusl may be delayed, and wudu before sleep is the sunnah.
Sahih al-Bukhari 1926
Sahih... يدركه الفجر وهو جنب من أهله ثم يغتسل ويصوم ...
"Dawn would come upon him while he was junub from his wife, then he would do ghusl and fast."
A fast begun in janabah is valid.
Where the ruling is recorded
- Radd al-Muhtar (Ibn Abidin), Kitab al-Taharah, chapter on ghusl. Ghusl becomes obligatory when prayer is due; delaying until then is permitted.
- Bada'i al-Sana'i, Kitab al-Sawm, section on what does not break the fast. Janabah at dawn does not harm the fast.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.