Praise be to Allaah.
The person who is junub is required to do ghusl in order to pray, and his prayer is not valid if he only does wudoo’.
He has to do ghusl even if he is afraid that the time for prayer in congregation will end, and even if he wakes up late and is afraid that the time for prayer will end if he does ghusl. The majority of scholars are of the view – which is the correct view – that he is obliged to do ghusl, because he is excused (with regard to the prayer).
In his case the time that counts is the time that he woke up, because of the report narrated by al-Tirmidhi (177), al-Nasaa’i (615), Abu Dawood (437) and Ibn Maajah (698) from Abu Qataadah who said: They mentioned to the Prophet (peace and blessings of Allaah be upon him) that they fell asleep and missed the prayer. He said: “There is no negligence when one is sleeping, rather there is negligence when one is awake. If any one of you forgets to pray, or sleeps and misses a prayer, then let him pray when he remembers.” Classed as saheeh by al-Albaani in Saheeh al-Tirmidhi. The hadeeth also appears in al-Saheehayn.
Ibn Qudaamah said, explaining the view of the majority: If water is available but the effort to acquire it and use it means that the time will end, it is not permissible for him to do tayammum, whether he is at home or travelling, according to the majority of scholars including al-Shaafa’i, Abu Thawr, Ibn al-Mundhir, and as-haab al-ra’i. It was narrated from al-Awzaa’i and al-Thawri that he may do tayammum. That was narrated from them by al-Waleed ibn Muslim. End quote from al-Mughni (1/166).
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) said: If a person wakes up at the end of the time for prayer and he is junub and is afraid that if he does ghusl the time for the prayer will end, he should do ghusl and pray, even if the time does end. The same applies to one who forgets it. End quote from al-Ikhtiyaaraat al-Fiqhiyyah.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) was asked: with regard to heating water, if a person has been lazy and got up late from sleeping in the desert, and he is afraid that the time will end –what should he do, should he heat the water or do tayammum?
He has to heat the water even if he is afraid that the time will end, because if the sleeper wakes up late, the time for prayer in his case is when he wakes up from sleep, and not from when the time for that prayer started, because the Prophet (peace and blessings of Allaah be upon him) said: “Whoever sleeps and misses a prayer or forgets it, let him offer it when he remembers it.” So the time for it begins when he remembers it, for one who forgot it, and when he wakes up, for one who slept. So we say: if you got up about five minutes or ten minutes before sunrise, and if you do tayammum you will manage to pray in time but if you do ghusl the time will end, we say that you should do ghusl even if the time will end, because the time for prayer in your case starts when you wake up, not from when the dawn breaks, because you are excused. End quote from Fataawa Noor ‘ala al-Darb.
And Allaah knows best.