All praise is due to Allah alone, and may the Salah and Salam of Allah be upon our Prophet Muhammad, his family and his companions. There are two cases for the one who wants to have a sex change, from male to female or vice versa; each of which has its own ruling. To elaborate: The first case is where the sex change is intended to manifest the original gender identity of a person, be it female or male, because they have some features of the opposite gender, be it feminine or masculine. In this case, it is permissible to have gender reassignment surgery and the person will take the ruling of their original gender. For example, if the original gender identity of a person is female but she has some masculine features, then it is permissible for her to remove the masculine features via whatever possible medical means in order to restore her original gender identity, which is the case in this question. Thus, she will be subject to all the rulings governing females, including the permissibility to marry a man. The second case is where the sex change is intended to conceal the original gender identity of a person and manifest a different gender identity through having a gender reassignment surgery. This is considered a major sin and changing the creation of Allah, which entails the punishment of Allah, the Exalted. However, it should be noted that, in this case, changing the gender identity does not change the reality of a person; therefore, they will still be subject to the same rulings applied on their original gender identity i.e. if a man changes his gender to become a woman, he will still be considered a man, and so it is impermissible for a man to marry him after his sex change. And Allah is the One who guides to the right path.
Your brother,
Prof. Khalid Al-Muslih 5/11/14343 A.H.