The Muslim should be devoted to being physically and spiritually pure. A Muslim has to purify his heart of all spiritual diseases and to purify his body from all impurities. Ghusl (bathing the whole body) is obligatory in certain situations that a Muslim should know to be pure and eligible for Salah (ritual Prayer) and Tawaf (circumambulation) of the Ka`bah during Hajj and `Umrah.

As for things that necessitate ghusl, here is the fatwa issued by Sheikh M. S. Al-Munajjid, a prominent Saudi lecturer and author:
“The things that make ghusl a must are:
1. The emission of semen, because the Prophet (peace and blessings be upon him) said: “What requires water (ghusl) is if you see water (i.e., semen) coming out of you.” (Reported by Muslim)
2. Contact between the genitals, because the Prophet (peace and blessings be upon him) said: “If one part enters the other part (in another report: if one part touches the other part), then ghusl becomes obligatory.” (Reported by Ahmad and Muslim) This ghusl is obligatory whether or not fluid (semen) is released. “Touching” here refers to the entry of the tip of the penis into the vagina, not mere touching.
3. Menstruation and nifas (post-natal bleeding), because Allah says what means: “. . . And when they have purified themselves, then go in unto them as Allah has ordained for you. . .” (Al-Baqarah: 222); and because the Prophet (peace and blessings be upon him) said to Fatimah bint Hubaysh (may Allah be pleased with her): “When your period starts, stop praying, and when your period ends, perform ghusl then start praying again.” (Reported by Al-Bukhari)
4. Death. The dead—except for a martyr slain in battle—must be washed (ghusl), because when his daughter Zaynab died, the Prophet (peace and blessings be upon him) said: “Wash her with water th
ree or five times, or as many times as you see fit.”
(Reported by Al-Bukhari). And when a man who was in a state of ihram (consecration for Hajj or `Umrah) was killed by his riding-beast, he (peace and blessings be upon him) said: “Wash him with water and lotus leaves and wrap him in his two garments, but do not embalm him or cover his head, for he will be raised on the Day of Resurrection pronouncing the Talbiyah.” (Reported by Al-Bukhari)

There are other types of ghusl about which the scholars differed as to whether they are obligatory, such as performing ghusl on Fridays, or whether a person who becomes Muslim needs to perform ghusl upon entering the faith.

There are types of ghusl which are encouraged, such as: ghusl on the two `Eids; ghusl after washing a dead body; ghusl before entering the state of ihram or entering Makkah; ghusl for a woman who is suffering from istihadah (abnormal non-menstrual bleeding) before every Prayer; ghusl after being unconscious; and ghusl after burying a mushrik (one who associates others with Allah).”