Allah has created both sexes: males and females, and they are both highly respected in Islam, the religion that strictly abolishes gender discrimination. In Islam, man and woman are equals in the sight of Allah. Therefore, there is no justifiable reason for what called sex change operations.

Sheikh Muhammad Iqbal Nadvi, Imam of Calgary Mosque, Canada, and Former Professor at King Saud Univ., Saudi Arabia, states: some related fundamentals should be established, so it will be easy to understand the Islamic ruling regarding to above-mentioned situation.
1. Almighty Allah created humans in two genders, male and female. This is has been stated in many verses: “O mankind! Be careful of your duty to your Lord Who created you from a single soul and from it created its mate and from them twain hath spread abroad a multitude of men and women.” (An-Nisaa’:1) “O mankind! We created you from a single (pair) of a male and a female.” (Al-Hujurat: 13)
“And that He createth the two spouses, the male and the female.” (An-Najm: 45)
Also refer to Surat Al-Layl: 3, and Ash-Shura: 49. Allah the Almighty also says in Surat Al `Imran, verse 36, that “the male is not as the female”
And in Surat Al-Layl He says: “Lo! your effort is dispersed (toward diverse ends).”
2. Allah, the Almighty, also said that He created every human being with Fitra (nature) that suits him or her. Since Fitra is an inbuilt system designed to suit every creation, the Fitra of a male is different from the Fitra of a female.
3. Allah, Exalted be He, also made it clear to us that when the Shaitan (Satan) challenged to deviate humans he said he would let them change the creation of Allah, the Almighty. Allah says: “And surely I will command them and they will change Allah’s creation.” (An-Nisa’: 119)
4. Every rule has an exception, so the hermaphrodite gender is an exception, and as it indicates, it is not a standard, but only a sign of Allah’s Power of creation, for a wisdom He knows better.
5. The Prophet, peace and blessings be upon him, has invoked the curse of Allah, the Almighty, upon “a male who imitates a female or vice versa.” This Hadith is about the matters of dress and fashion, but it also explains the importance of gender in Islam. So, if an imitation in outward appearance is counted as a sin, then by Qiyas (analogy), a total change in gender will be even more sinful act.
6. Allah, Glorified be He, says: “And covet not the thing in which Allah hath made some of you excel others. Unto men a fortune from that which they have earned, and unto women a fortune from that which they have earned. (Envy not one another) but ask Allah of His bounty. Lo! Allah is ever Knower of all things.” (An-Nisa’: 32)
This means that Allah, the Almighty, created each of us in one gender, in one shape, while he or she likes another gender, but as a Muslim and believer he or she has to accept the destiny of Allah.
In the light of the above-mentioned basic facts, I would conclude by saying that it is not allowed in Islam to change the gender, and doing so will be changing of Allah’s creation.
The only exception to this ruling is related to a person who has both genders potential in body, so a medical treatment can be sought to unify one gender. In this case it will be a correction, and not a change in the creation of Allah, the Almighty. This issue has been previously discussed by our earlier Fuqahaa’ (jurists) and the same ruling has been given.
In shedding more light on the prohibition of sex change (save the medical necessities mentioned above), Sheikh M. S. Al-Munajjid, a prominent Saudi Islamic lecturer and author states:
“It is not permissible for a person to have gender operation; from male to female or vice versa. Every Muslim has to be content with what Allah has decreed for him/her, for He has placed him in a suitable position. He/she does not know what is good for him/her; (being a male) perhaps if he was created female, that would not be good for him, or (being a female) if she was created male, that would be bad for her. By the same token, there are some people for whom nothing but poverty is good, and if Allah made such a person rich it would be harmful for him; and there are others for whom nothing but richness is appropriate, and if they became poor that would be harmful to them.
Some women wished they had been created men so they could fight in the way of Allah. This was just wishful thinking, but Allah revealed the prohibition of that wishful thinking in the ayah (Qur’anic verse):
“And wish not for the things in which Allah has made some of you to excel others. For men there is reward for what they have earned, (and likewise) for women there is reward for what they have earned.” (An-Nisa’:32)
If mere wishful thinking is forbidden, then how about taking action upon such thinking? If a Muslim is forbidden to change the creation of Allah in minor cases, so how about changing sex altogether?
Sheikh `Abd Al-Karim Al-Khudayr states: Changing one’s sex is a kind of tampering with the creation of Allah and following the way of the Shaitan (Satan) who vowed that he would misguide the sons of Adam in this way and in others, as clarified in the verse: “And surely I will command them and they will change Allah’s creation.” (An-Nisa’: 119) We pray to Allah to keep us safe and sound.”