كتاب الحج
15  
The Book of Pilgrimage
(10)
Chapter: It is permissible for a Muhrim to shave his head if there is a problem, but it is obligatory to offer a Fidyah for shaving it, and Clarifying what the Fidyah is
(10)
باب جَوَازِ حَلْقِ الرَّأْسِ لِلْمُحْرِمِ إِذَا كَانَ بِهِ أَذًى وَوُجُوبِ الْفِدْيَةِ لِحَلْقِهِ وَبَيَانِ قَدْرِهَا
Sahih Muslim 1201 g

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 reveal- ed In my case. There was some trouble in my head. I was taken to the Messenger of Allah (ﷺ) 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:" Com- pensation (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 perscins, half sa' of food for every needy person. This verse was revealed particularly for me and (now) Its applica- tion is general for all of you.
وَحَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى، وَابْنُ، بَشَّارٍ قَالَ ابْنُ الْمُثَنَّى حَدَّثَنَا مُحَمَّدُ بْنُ جَعْفَرٍ، حَدَّثَنَا شُعْبَةُ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ الأَصْبَهَانِيِّ، عَنْ عَبْدِ اللَّهِ بْنِ مَعْقِلٍ، قَالَ قَعَدْتُ إِلَى كَعْبٍ - رضى الله عنه - وَهُوَ فِي الْمَسْجِدِ فَسَأَلْتُهُ عَنْ هَذِهِ الآيَةِ ‏{‏ فَفِدْيَةٌ مِنْ صِيَامٍ أَوْ صَدَقَةٍ أَوْ نُسُكٍ‏}‏ فَقَالَ كَعْبٌ رضى الله عنه نَزَلَتْ فِيَّ كَانَ بِي أَذًى مِنْ رَأْسِي فَحُمِلْتُ إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم وَالْقَمْلُ يَتَنَاثَرُ عَلَى وَجْهِي فَقَالَ ‏"‏ مَا كُنْتُ أُرَى أَنَّ الْجَهْدَ بَلَغَ مِنْكَ مَا أَرَى أَتَجِدُ شَاةً ‏"‏ ‏.‏ فَقُلْتُ لاَ فَنَزَلَتْ هَذِهِ الآيَةُ ‏{‏ فَفِدْيَةٌ مِنْ صِيَامٍ أَوْ صَدَقَةٍ أَوْ نُسُكٍ‏}‏ قَالَ صَوْمُ ثَلاَثَةِ أَيَّامٍ أَوْ إِطْعَامُ سِتَّةِ مَسَاكِينَ نِصْفَ صَاعٍ طَعَامًا لِكُلِّ مِسْكِينٍ - قَالَ - فَنَزَلَتْ فِيَّ خَاصَّةً وَهْىَ لَكُمْ عَامَّةً ‏.‏
Reference : Sahih Muslim 1201g
In-book reference : Book 15, Hadith 93
USC-MSA web (English) reference : Book 7, Hadith 2738
  (deprecated numbering scheme)