Praise be to Allah.
A hair transplant involves transferring hair follicles from one area to another, and there is nothing wrong with that, because it is correcting a defect, not changing the creation of Allah, may He be glorified and exalted.
In a statement of the Islamic Fiqh Council belonging to the Organization of Islamic Cooperation (OIC), issued during its eighteenth session in Malaysia, 24-29 Jumaada al-Aakhirah 1428 AH/4-9 July 2007 CE, concerning cosmetic procedures, explaining what types of procedures are permissible, it says: Correcting acquired defects that result from burns, accidents, illness and so on, such as skin grafts, dermabrasion, breast reconstruction following mastectomy, breast reshaping if the breasts are so large or so small that it leads to sickness, and hair transplants in the case of hair loss, especially for women. End quote.
Shaykh Muhammad ibn ‘Uthaymeen (may Allah have mercy on him) was asked: Hair transplants may be done for one who is affected by baldness, by taking hair from the back of the head and transplanting it to the affected area. Is that permissible?
He replied: Yes, that is permissible, because this comes under the heading of restoring what Allah, may He be glorified and exalted, had created, and also under the heading of correcting a defect. It does not come under the heading of beautification or adding to what Allah, may He be glorified and exalted, has created, so it does not come under the heading of changing the creation of Allah; rather it comes under the heading of restoring what has been lost and removing a defect. There is the well-known story of the three men, one of whom had become bald and said that he would like Allah, may He be glorified and exalted, to restore his hair, so the angel touched him and Allah restored his hair, and gave him beautiful hair.
End quote from Fataawa ‘Ulamaa’ al-Balad al-Haraam, p. 1185.
The hadith to which the shaykh (may Allah have mercy on him) referred was narrated by al-Bukhaari (3277) and Muslim (2964).
What appears to be the case is that there is no difference between taking hair follicles from the individual himself or from someone else.
And Allah knows best.