I have come across this following Hadith with some variations:
حَدَّثَنَا مُوسَى بْنُ إِسْمَاعِيلَ، حَدَّثَنَا هَمَّامٌ، عَنْ قَتَادَةَ، عَنْ أَنَسٍ ـ رضى الله عنه :
The climate of Medina did not suit some people, so the Prophet (ﷺ) ordered them to follow his shepherd, i.e. his camels, and drink their milk and urine (as a medicine). So they followed the shepherd that is the camels and drank their milk and urine till their bodies became healthy. Then they killed the shepherd and drove away the camels. When the news reached the Prophet (ﷺ) he sent some people in their pursuit. When they were brought, he cut their hands and feet and their eyes were branded with heated pieces of iron. (Sahih al-Bukhari 5686) [ Variations : Sahih al-Bukhari 6802 ; Jami` at-Tirmidhi 72 ; Sahih al-Bukhari 1501 ; Sunan ibn Majah Hadith 3632 ; Sunan an-Nasa'i 4024 ]
The hadith seems to contradict notions of purity of consumption of food and water in the Quran and common sense. Moreover, the prophet mutilated them for crime that seems very conspicuous. What could be the right interpretation of this hadith? Is this hadith sound in terms of content and narrators?
According to this narrative, the Holy Prophet (sws) advised these people to drink the milk and urine of camels. They were asked to drink the urine as medicine for their ailment, not as a normal food item. In those times, people normally treated the ailments by the things that were easily available in their environment. As a principle in our faith, even a food item that is normally considered haram can be consumed as medicine if nothing else is available to treat the disease. So the common restrictions of diet do not apply in this case.
The narrative then goes on to say that after having recovered from their ailment, they killed the official herdsmen and drove away the herd of camels. The Prophet (sws), in conformity with the directive of the Qur'an relating to crimes committed against the state (Al-Maaidah 5: 33), sentenced them to the punishment of amputation of hands and feet;
There is only one part of the referred narrative, which raises a question-mark in one's mind. It apparently seems strange that after having implemented the punishment prescribed in the Qur'an for crimes committed against the society, in general, why did the Prophet (sws) ordered their eyes to be branded. Most of the narratives do not provide an answer to this question. However, in one of the narratives reported in Ibn Al-Jarood's Al-Muntaqaa, Anas (ra) is reported to have explained the reason for this punishment as well. The companion of the Prophet (sws) is reported to have said:
عَنْ أَنَسٍ، رَضِيَ اللَّهُ عَنْهُ " أَنَّ النَّبِيَّ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ إِنَّمَا سَمَرَ أَعْيُنَهُمْ لِأَنَّهُمْ سَمَرُوا أَعْيَنَ الرُّعَاةِ
The Prophet (sws) branded their eyes because they had branded the eyes of the herdsmen. (volume 1, Pg. 216- Number 847)
This explanation adequately clarifies the fact that the Prophet (pbuh) ordered the branding the eyes of the culprits, in compliance with the Qur'anic directive of Qisaas (Al-Baqarah 2: 178, Al-Maaidah 5: 45) for the punishment of murder and inflicting physical injury on someone.
In view of the foregoing explanation, I find no reason to consider the incident narrated in the referred narrative to be unauthentic.
I hope this helps.