"By the grace of Allah, you are gentle towards the people; if you had been stern and harsh-hearted, they would have dispersed from round about you." The noble Qur'an, A'al-Umran(3):159
The following is a Hadith from the books of Bukhari and Muslim:
Hadrat Anas ibn Malik (may Allah be pleased with him) said: While we were in the mosque with Allah's Messenger (may Allah's blessings and peace be upon him) a desert Arab came and began to pass water in the mosque. The companions of Allah's Messenger said, "Stop! Stop!" but Allah's Messenger (may Allah's blessings and peace be upon him) said, "Don't interrupt him; leave him alone." They left him alone, and when he had finished, Allah's Messenger (may Allah's blessings and peace be upon him) called him and said to him, "These mosques are not suitable places for urine and filth, but are only for remembrance of Allah, prayer and recitation of the Qur'an," or however Allah's Messenger expressed it.* Hadrat Ibne Malik (may Allah be pleased with him) said that he then gave orders to one of the people who brought a bucket and poured water over it. (Bukhari and Muslim)
*Indicating that the transmitter is not sure of the exact words.
It has been narrated on the authority of Hadrat Anas Ibn Malik (may Allah be pleased with him) that eighty persons from the inhabitants of Makka swooped down upon Allah's Messenger (may Allah's blessings and peace be upon him) from the mountain of Tan'im. They were armed and wanted to attack the Holy Prophet (may Allah's blessings and peace be upon him) and his Companions unawares. He (the Holy Prophet) captured them but spared their lives. So, Allah (The Glorified and the Exalted) revealed the verse:
"And It is He Who restrained your hands from them and their hands from you in the valley of Makkah after He had given you a victory over them." (48:24)
1638. Ibn `Umar (May Allah be pleased with them) said: The Messenger of Allah (PBUH) forbade shaving a part of the head.
[Al-Bukhari and Muslim].
1639. Ibn `Umar (May Allah be pleased with them) said: The Messenger of Allah (PBUH) saw a boy, some portion of whose head was shaved and some of it was left out. He prohibited them from that and said, "Shave the whole of it or leave the whole of it.''
Commentary: This order of Prophet (PBUH) was based on the reason that that hair-style was then in vogue among the Jews and Christian priests and ascetics. This style was also popular with the group which was given to mischief and disobedience. This is, however, permissible in exceptional circumstances. In any case, either one should shave the hair completely or keep them in such a style that there is no resemblance with women.
1640. `Abdullah bin Ja`far (May Allah be pleased with them) said: The Prophet (PBUH) gave respite for three days to the family of Ja`far (after his martydom). Then he came and said, "Don't weep for my brother after this day.'' He said, "Bring all of my nephews to me.'' We were accordingly brought as if we were chickens. Then he said, "Call for me a barber.'' He directed him to shave our heads which he did.
Commentary: Ja`far was the cousin of the Prophet (PBUH) and he was martyred in the battle of Mu'tah. Although martyrdom is an honour but even then the bereaved family does feel the shock of the loss. For this reason, the Prophet (PBUH) permitted them to give vent to their grief for three days. It should not, however, be taken to mean that he allowed them to lament and wail, because that is prohibited. What he actually allowed them was the natural weeping which does occur when people come for condolence and speak of the deceased. Such expression of grief is permissible after a period of three days also.
Therefore, what the Prophet (PBUH) had advised them was not in the nature of unlawful but natural. The children of the deceased called themselves "chickens'' as they were greatly enervated by the tragedy. This Hadith has been mentioned here to confirm the validity of shaving the hair of the head, especially of children, although keeping bobbed hair is more meritorious because the Prophet (PBUH) himself did so. Bobbed hair are cut short and allowed to hang loosely.
1641. `Ali (May Allah be pleased with him) said: The Messenger of Allah (PBUH) prohibited a woman from shaving her head.
Commentary: This Hadith is also included in At-Tirmidhi but Sheikh Al-Albani has regarded it "Da`if'' (weak). Please see Ahadith Ad-Da`ifah. However, in order to avoid resemblance with men, this prohibition for women will stand. If it is required on medical ground then it will be permissible.