There are some cases in which a Muslim must perform ghusl (ritual bath) such as release of semen either in sleep or awake, sexual intercourse even if there is no release of semen, and other cases.
On the other hand, there are some situations in which ghusl is preferred as follows:
1- Before the Friday Prayer
Muslims are encouraged to perform ghusl before they gather for the Friday (Jumu`ah) Prayer. In fact, the Shari`ah (Islamic Law) even goes to the extent of ordering one to perform ghusl at this time as part of the overall cleanliness and hygiene of the Muslim society. Abu Sa`id Al-Khudri (may Allah be pleased with him)narrated that Allah’s Messenger (peace be upon him) said, “The taking of a bath on Friday is compulsory for every male (Muslim) who has attained the age of puberty.” (Al-Bukhari)
The obligation here means that it is highly recommended. Abu Hurairah (may Allah be pleased with him) reported that the Prophet (peace be upon him) said, “Whoever makes the ablution and perfects it and then goes to the Friday Prayer and listens attentively, will have forgiveness during (the period) between the Friday and the next (Friday), and an additional three days.” (Muslim)
Al-Qurtubi says that this hadith shows that ghusl is preferred. The mention of ablution, the reward and acceptability points to the fact that ablution alone is sufficient.”
The time for the Friday ghusl is between dawn and the time of the Friday Prayer. It is preferable to do it at the time of departure (to the mosque). If one loses his ablution after that, it is sufficient for him just to make a new ablution (he does not have to repeat the ghusl).
2- Before the `Eid Prayer
Scholars also encourage Muslims to perform ghusl for the `Eid Prayer, even though there is no authentic hadith to support this opinion.
3- Ghusl for Washing a Corpse:
According to many scholars, performing ghusl is also preferred for one who has washed a corpse. Abu Hurairah (may Allah be pleased with him) reported that the Prophet (peace be upon him) said: “Whoever has washed a corpse must perform ghusl, and whoever carried him must perform ablution.” (Ahmad, Abu Dawud and At-Tirmidhi)
The order in the hadith implies preference, based on what has been related by `Umar ibn Al-Khattab (may Allah be pleased with him) who said, “We used to wash the dead. Some of us would perform ghusl and some would not.” (Al-Khatib)
4- Performing Ghusl for Hajj:
It is preferable for one who is undertaking the pilgrimage or `Umrah to perform ghusl. Zayd ibn Thabit (may Allah be pleased with him) narrated that ewhen the Messenger of Allah (peace be upon him)intended to perform hajj he perform ghusl.” (Ad-Daraqutni)
5- Making Ghusl upon Entering Makkah:
It is preferable for whoever wants to enter Makkah to perform ghusl. It is reported that that Ibn `Umar (may Allah be pleased with him) when going to Makkah, would spend the night in Tuwa, and would enter Makkah during the day. He mentioned that the Prophet (peace be upun him) also used to do this. (Al-Bukhari)
6- Making Ghusl at Mount `Arafah:
Such act is preferred while one stops there during hajj. Malik ibn Nafi` reported that Ibn `Umar (may Allah be pleased with him) used to do so before embarking upon hajj, upon entering Makkah, and while stopping at `Arafah.
Quoted with slight modifications from Sayyid Sabiq’s Fiqh As-Sunnah.Soucre Link