In many cultures, sexuality is the physiological or emotional drive responsible for physical attachments stemming either from a biological or societal need to bond with a mate. This adaptation primarily facilitates sexual reproduction, however, even those attracted that cannot or do not reproduce still have a deep-seated need for the kind of satisfaction a mate provides. In many cases, the ties contribute to causing permanent or long-lasting sexual relationships, which may be monogamous or polygamous. Some species, like Vulcans, have a telepathic bond which forms between mates. (TOS: "Amok Time")
Many species have complex interactions and communications involved in approving or rejecting a potential mate; chemical adaptations such as attractive pheromones have also been evolved by some lifeforms, such as Orions. (ENT: "Bound")
Deltans are also known to project a strong sexual presence even without physical contact which may include pheromones and some subconscious telepathic elements; the effects are sufficiently strong as to influence other species. (Star Trek: The Motion Picture)
This drive can also lead individuals to enter a relationship or mate for reasons of satisfaction or emotional fulfillment rather than procreation. Individuals of many species have also been known to enter into homosexual relationships. Many individuals encountered in the mirror universe have been known to seek out homosexual attachments. (DS9: "The Emperor's New Cloak")
While Beverly Crusher ended her relationship with Odan in female form and Jadzia Dax ended her relationship with Lenara Kahn, the reasons given were not due to sexual preference. Crusher cited the changing of host bodies and Dax's reason was the taboo act of reassociation. (TNG: "The Host"; DS9: "Rejoined")
The Doctor had to upload his program to Seven of Nine effectively taking over her body and being in full control of it. Seven of Nine was mentally aware of the Doctor becoming sexually aroused in her body while being massaged by Doctor Jaryn . (VOY: "Body and Soul")
Some cultures, such as the J'naii, have been known to enforce laws prohibiting the occurrence of sexual acts considered deviant by the majority of the population. In their case, any individual who adopts a gender is given psychotectic treatments to restore them to the species' androgynous norm. (TNG: "The Outcast")
In the 24th century, Starfleet personnel seemed to require permission from a CMO and their commanding officers to engage in sexual relations with members of alien species, although this formality was only shown being observed once on board USS Voyager. (VOY: "Prophecy") Nevertheless, its breach was the basis for a reprimand being entered into Harry Kim's permanent record. When Kathryn Janeway informed Kim of the reprimand, she indicated that the regulations on inter-species sexual contact were "three centimeters thick." (VOY: "The Disease")
In the 24th century, gender-reassignment surgery, otherwise known as a sex change, was known to be performed. In 2374, Dr. Bashir performed such surgery on Quark with no complications or special preparations mentioned. The surgery performed on Quark was more than mere facial cosmetics: Bashir injected female hormones into Quark, and at the end of the episode, Quark removed his clothing to prove that he's a "real" female. The onlooking businessman noted that Quark looked like a female, indicating that Bashir had made physical changes to the chest and/or genital areas of Quark's body. (DS9: "Profit and Lace")
Background information Edit
Unless Human nature has changed between modern times and the era of Star Trek, there are probably many homosexual individuals throughout the Human culture of the future, but they are rarely specified as such in any canon sense. Federation culture does not seem very sexually repressive, so it is likely that all heterosexual, bisexual, homosexual or transgender members of their society are regarded as equals, and as such, none of the people seen on Star Trek have had any need to present or justify any of their sexual preferences unless it occurred in the course of an episode or movie; therefore, we have very little information about their sexual culture. However, behind-the-scenes information suggests the lack of homosexual relationships on Star Trek is more plausibly explained by prevalent Western social taboos, as the television series and films tend to avoid addressing what it is like to be gay in the future. The production team over the years has stated that they do not want to create a "token" homosexual character for the express purpose of the issue, anymore than they want to create a black character purely to address racial issues. This explanation may be misleading. Star Trek did of course depict black characters, as would be expected simply because its vision of the future did not exclude black humans; whereas of its numerous depictions of sexual attraction, none happened to be truly same-sex. (citation needed • edit)
Many non-canon comics, games and novels have taken much more liberty than filmed Star Trek in describing attitudes about sexual freedom and homosexuality in alien cultures. Star Trek creator Gene Roddenberry in particular was known for adding many sexual themes to his creations. Some of his drafts for stories from the unproduced Star Trek: Phase II series would have been the inclusion of scenery from Earth portraying it as a nudist paradise. Some of his contributions of this nature ended up influencing the story of the Edo in TNG: "Justice".
Actors such as Patrick Stewart, Kate Mulgrew, and Scott Bakula have been quoted in magazines stating their interests in seeing openly homosexual characters. Scripts have been written to include openly gay characters but never made it in to production, and suggestions of characters to be introduced as gay or lesbian had never come to fruition in the series in which they appeared.