Praise be to Allah.
The Islamic Fiqh Council answered this question as follows:
Transplanting reproductive glands. Because the testicles and ovaries continue to carry and produce the genetic characteristics (DNA) of the original donor even after being transplanted into a new body, the transplanting of reproductive glands is not permitted according to Islamic sharee’ah.
Transplanting other parts of the reproductive organs. Transplanting parts of the reproductive system which do not transmit DNA (with the exception of the private parts themselves) is permissible in cases of legitimate necessity as long as the relevant rulings and regulations of sharee’ah are adhered to.
And Allah knows best.