All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
We have previously clarified the conditions and rulings of the hermaphrodite (a person with both male and female characteristics) in Fatwa 82158, so kindly refer to it for it is of great importance.
If you are a problematic hermaphrodite (or what is called in Arabic Khuntha Mushkil), then it is allowed to undergo an operation to change into a male or a female according to the view which the doctors consider to befit your characteristics after making the required physical examinations. If your condition has a clear gender (either male or female), then fear Allaah The Almighty and be patient.
As for marriage, if your condition has a clear gender from the beginning or after undergoing a sex change operation with its conditions, then there is no harm in marrying. That is because you are no longer a problematic hermaphrodite. The one who is not allowed to marry, according to most of the scholars, is the problematic hermaphrodite since he/she is treated according to the rulings which are safest.
There is another opinion that he/she is allowed to marry. Al-‘Izz ibn ‘Abdus-Salaam said: “Marriage of a problematic hermaphrodite is invalid to ward off the evil of a woman marrying a woman or a man marrying a man. However, Ash-Shaafi‘i was quoted to have said that marrying him/her is lawful. In his book Al-Umm, he said: "If he/she is problematic, he/she is allowed to marry according to the gender he/she wishes. However, if he/she married according to one gender, he/she would not be allowed to marry again according to the other gender. He/she can inherit and be inherited according to where he/she urinates from (i.e. from the penis or from the vaginal area.” [End quote]
As for your statement “What gender will I be in Jannah? Will I be male or female?”, then this can only be asked by the one whose condition remained problematic. However, if someone is problematic to us, he/she is not so to the Lord of the worlds Who created him/her. Some scholars of Tafseer (interpretation of Quran) said regarding the saying of Allaah The Almighty (which means): {And [by] He who created the male and female.}[Quran 92:3]: “Allaah The Almighty never created anything of living creatures except it should be a male or female. As for the hermaphrodite, even if his/her condition is problematic for us, it is not so for Allaah The Almighty, i.e. it is known whether he/she is male or female.”
Allaah Knows best.