In Kabbalah, there is a concept mentioned by the Ari: a man who engages in "anal sex" with a male (Shokhev Zakhar) may sotospeak reincarnate as a woman in a future life. The purpose of a male higher-soul (Nshama) choosing to incarnate as a female physical-soul (Nefesh) is to understand masculinity and femininity and to restore them. However, a male soul in a female body was thought to experience emotional pain from the dissonance. Moreover, it was understood that it is difficult for such an individual to give birth to children, especially a male child. This is a problem because halakha requires the Jewish husband to beget at least one female and at least one male. It is a historically important Rabbinic commentary on transsexuality.
Clashes between IDF and protesters in Bethlehem and East Jerusalem (Reuters)
from the article: Reform Movement publishes blessings for sex change operation