Kaab bin Ujra reported,

We were with the Messenger of Allah ﷺ at Hudaybiyyah while we were in the state of ihram, and the polytheists had blocked our way. I had thick hair, and lice began falling onto my face. The Prophet ﷺ passed by me and asked, "Are the lice on your head bothering you?"I replied, "Yes."So he ordered him to shave his head. He said, then this verse was revealed, "And whoever among you is ill or has an ailment of the head must offer a ransom of fasting, charity, or sacrifice" [Baqarah 2:196].

Ahmad 18101

Sahih

حدثنا هشيم أخبرنا أبو بشر عن مجاهد عن عبد الرحمن بن أبي ليلى

عن كعب بن عجرة قال

كنا مع رسول الله ﷺ بالحديبية ونحن محرمون وقد حصرنا المشركون وكانت لي وفرة فجعلت الهوام تساقط على وجهي فمر بي النبي ﷺ فقال أيؤذيك هوام رأسك قلت نعم فأمره أن يحلق قال ونزلت هذه الآية {فمن كان منكم مريضا أو به أذى من رأسه ففدية من صيام أو صدقة أو نسك}

أحمد 18101صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Kaab bin Ujra
Numbering
Darussalam 18101
Ahmad 18101