All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
It is impermissible for a doctor to use this unlawful means in treatment. That is because good ends do not justify using unlawful means. Moreover, adopting such means does not yield the sought results; rather, they often lead to opposite results. The reason behind homosexuality is the temptation of the devil and the following of personal whims. This is treated by evoking this person's fear of Allah Almighty by telling him about the punishment of those who follow their inclinations and obey the devil. The patient should also be urged to sincerely repent to Allah before he is suddenly overtaken by death. Assuming that homosexuality has turned into a psychological disease, it should be treated with permissible means that are known to specialists. There is no treatment to be expected from things that are forbidden by Allah, the Exalted. The spread of such phenomena is but a result of giving free rein to the souls and allowing them to deeply indulge in vice as if there is none to watch or monitor him.
Allah knows best.