Ka'b bin Ujrah (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings be upon him) stood by me at Hudaybiyah while lice were falling from my head. He (peace and blessings be upon him) asked: "Are your lice troubling you?" I said: Yes. He said: "Shave your head." So it was about me that this verse was revealed: "And whoever among you is ill or has an ailment of the head must give a ransom of fasting, charity or a sacrifice" [Surah al-Baqarah: 196]. The Messenger of Allah (peace and blessings be upon him) said: "Fast three days, or give a faraq (of food) in charity among six people, or offer whatever sacrifice is available."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحج / 8704