Our Gemara on 54b and 55b quotes a Bibllical phrase in Vayikra 18:22 where it describes sexual intercourse as “Mishkavei Isha”, the “Layings in regard to women”.  Though the pashut peshat is referring to sexual acts, the derash takes this to imply multiple forms of sexual intercourse, such as anal intercourse.

Rabbenu Chananel on this verse (also quoted by Ibn Ezra) offers a creative explanation with modern relevance,  One usage of this idiom is referring to homosexuality, thus the pashut peshat, is “laying with a man in a manner that mimics heterosexual intercourse.”  However, Rabbenu Chananel says:

יש מי שיחדש בגופו כצורת בשר אשה

There are persons who are able to innovate in their bodies some manner that is in the form of a woman.

Rabbenu Chananel seems to be referring to transsexuals who are able to transform themselves into females.  It is unclear if he is talking about modifications in appearance by cosmetics, such as makeup or dress, or something more fundamental such as a surgical procedure. Do not assume that surgical techniques were not available in ancient times.  They might have been a lot more dangerous and painful, but still possible.

Here are some examples of ancient plastic surgical techniques:  (1) Spleen removal (see Ramban Chulin 58b, and Pliny: Historia naturale di C. Plinio Secondo di latino in volgare tradotta per Christophoro Landino, et nuouamente Gabriel Giolito di Ferrari, Venice (1543)); (2) The extension of the foreskin to disguise one’s status as a Jew, Sanhedrin 44a and Rashi Op. Cit; and (3) a Cesarean Section, Mishna Niddah 5:1 (though Commentary of the Rambam on Mishna Bechoros 8:2 maintains that it is impossible for a woman to survive the procedure, other authorities might disagree, as the simple reading of the Mishna in Niddah which discusses the woman’s Niddah status implies she survives. We also know that knowledge of natural antibiotics, as well as suturing techniques were sophisticated in Greek times, see CopeZ (1958) The treatment of wounds through the ages. Med Hist2: 163-174. Rachel Hajar (2012) The Air of History: Early Medicine to Galen (Part I) Heart Views 13: 120-128. D Mackenzie (1973) The history of sutures. Med Hist 17: 158-168.) (4) In Chulin (57a) a person who suffered am injury whereby his intestines came out was sutured back up.

The halakhic implications of this peshat of Rabbenu Chananel might be that even if a person underwent gender reassignment surgery, “she” would still be considered a male and forbidden in sexual intercourse with another male.  However, on second thought, Rabbenu Chananel might be referring to someone who still largely appears as male, but only modified that part of their anatomy.  Possibly, if one appears fully as a different gender and the surgical transformation is complete, the halakha should go by appearances and not chromosomal realities.  Halakha generally follows visual perception and not microscopic perception.  

The Tzitz Eliezer (11:73) rules that when a child is born with some degree of external gender ambiguity, but has the chromosomes of a male, and overall genital appearance of a female, it is permitted to surgically correct the ambiguities.  Thus, he seems to be ruling that we follow appearance.  Also Tzitz Eliezer rules (volume 10, teshuva 25, ch. 26:6) that a married man who had gender reassignment surgery and became a “woman”, no longer needs to divorce his wife.  Apparently, he is halachically a woman, and the marriage is automatically dissolved.  It is notable that Rabbi Waldenberg’s opinion is a lone one, and this can be especially problematic as in some ways, a person who has had Male to Female surgery may literally, have burned the candle at both ends.  Here is why:  If this person is not considered to be a woman, which aside from Rabbi Waldenberg, no other authority has maintained this position, “she” cannot marry a Jewish female either.  This is because it is forbidden for a Jewish female to marry a male with significantly deformed sexual organs (Shulkhan Arukh, EH 5:1). And since he is still considered male by most poskim, “she״ cannot marry a male as well.