Sayyiduna Ka'b bin Ujrah al-Ansari (may Allah be pleased with him), who was from Banu Salim, said: In the year of al-Hudaybiyah I was with the Messenger of Allah (peace and blessings be upon him) when lice infested my head, until I began to fear for my eyesight. Then Allah, the Mighty and Majestic, revealed this verse: "And whoever among you is ill or has an ailment of the head, then a ransom of fasting or charity or a sacrifice" [Surah al-Baqarah: 196]. Then the Messenger of Allah (peace and blessings be upon him) called me and said: "Shave your head and fast three days, or feed six poor people one faraq of raisins, or slaughter a goat." So I shaved my head, then offered a sacrifice.
Hadith Referenceالمعجم الكبير للطبراني / باب الكاف / 16308