Answer
(Fatwa: 308/221=L/1430)
It is haram and major sin to have sex-change operation. Muslims aught not to do it, the hadith curses the men adopting the resemblance of women and women adopting the resemblance of men. And changing gender is more heinous. However, if someone got sex-change operation and the gender was changed e.g. previously if it was man and changed to a woman, then it will be treated as woman. Likewise, if it was woman and changed to man, then it will be treated as man.
Allah (Subhana Wa Ta’ala) knows Best
Darul Ifta,
Darul Uloom Deoband