Sahih Muslim Book 7, Hadith Number 2738.

Chapter : It is permissible to shave the head in the state of Ihram if there is a trouble, and expiation becomes obligatory for shaving.

Abdullah b. Ma’qil said: I sat with Ka’b (Allah be pleased with him) and he was in the mosque. I asked him about this verse: “Compensation in (the form of) fasting, or Sadaqa or sacrifice.” Ka’b (Allah be pleased with him) said: It was revealed In my case. There was some trouble in my head. I was taken to the Messenger of Allah (may peace be upon him) and lice were creeping upon my face. Thereupon he said: I did not think that your trouble had become so unbearable as I see. Would you be able to afford (the sacrificing) of a goat? I (Ka’b) said: Then this verse was revealed: “Compensation (in the form of) fasting or alms or a sacrifice.” He (the Holy Prophet) said: (It Implies) fasting for three days, or feeding six needy persons, half sa’ of food for every needy person. This verse was revealed particularly for me and (now) Its application is general for all of you.