Purity means cleanliness, and in Shariah it means cleanliness in a specific way for two kinds of things and their consequences:
First: Impurities that have a material consequence such as urine, stools, blood etc - things that the Shariah calls ‘najasah’, i.e. impurity, and which have been given the term ‘najasah khabathiyyah’, and to achieve purity from which has been given the term ‘At-Taharah min al-khabath’.
Second: Consequences that are related to the soul and body due to sleeping, urine, menses, janabah (intercourse etc) and the like, which have been given the term ‘al-Hadath’, and to achieve purity from which, through ablution (wudu’) or washing (ghusl), is called ‘at-taharah min al-hadath’.
And here are definitions of some terms used in this area:
Al-Hadath – the second kind mentioned above – has two categories:
Al-Hadath al-Asghar (small occurrence), which is what is removed by ablution and these are: passing urine, passing stools, passing wind, slight istihadah (blood seen by women that is not from the menses) and the occurrence of whatever makes awareness absent, such as sleeping, drunkenness or falling unconscious.
Al-Hadath al-Akbar (big occurrence), which cannot be removed except by washing (ghusl) and these are: death, janabah, nifas (blood seen during or after giving birth), medium or excessive istihadah or touching the dead.
An-Najis is specifically al-A‘yan an-Najisah - things that are inherently unclean, which are the first source for impurity, such as urine, stools and blood.
Al-Mutanajjis is everything that is originally pure then acquired impurity in a specific way. In other words, it is any pure body or thing that was affected by an impure thing touching it.
Purity from hadath or khabath is not obligatory in itself, but obligatory for starting any act in which cleanliness is obligatory, such as praying, performing the circum-ambulation around the Ka’bah, entering mosques, touching the words of the Qur’an etc. In other words, one cannot perform any of these acts unless one is clean. Cleanliness/purity may also become obligatory if it becomes part of a vow (nithr), covenant (‘ahd) or oath (yameen), such as when one vows to stay in an ablution-pure state, or to purify one's clothes or body from any najasah khabathiyyah immediately, or the like.
Apart from that, it was narrated that it is recommended that one stays pure from hadath all the time. Also, it was narrated that ablution and washing is recommended for a lot of recommended acts.