This gets in to the arena of diversity of gender expression in the real world as well. Very often, folks assume that there are only two options - male or female. Folks also assume that the ultimate goal of a transgender person must be to completely change from one gender to another.
This isn't the case. Gender is expressed in a huge range of variations. Likewise, each transgender person decides, based on their own needs and comfort level, what aspects of themselves to transition. For some, hormones and surgery are the way to go. For others, hormones are enough. For still others, it is simply a matter of saying to themselves (and perhaps others) that they are another gender.
There are also intersex, genderqueer, and genderfluid individuals, all of whom express gender in ways outside the binary.
To bring this back around to fantasy gaming and your questions, magic can certainly have a huge influence on gender expression for characters, but it greatly depends on the availability of magic in the setting. In Eberron, for example, I imagine that there would be easier access to gender-morphing magic. In Dark Sun, however, gender variant individuals would have few options. However, even magic has limits. It may not be able to accommodate a gender queer character's vision for their body. It may be "all or nothing" and therefore not the best option for some transgender characters. The cultures of the setting also warrant discussion. A culture that is paranoid about shapeshifters like changelings and doppelgangers is also going to be suspicious of people using polymorph magic. A great many fascinating stories could arise out of such situations...if the players and GM are open to exploring that sort of thing.
On a side note, for transgender and gender variant folks out here in the real world, fantasy roleplaying can provide an outlet for our frustrations. Being able to fantasize about playing a character who can magically change gender, or even playing a cisgender character of our true gender, can be liberating and cathartic.