In many cultures, sexuality was 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 facilitated sexual reproduction, however, even those attracted that could not or did not reproduce still had a deep-seated need for the kind of satisfaction a mate provided. In many cases, the ties contributed to causing permanent or long-lasting sexual relationships, which could be monogamous or polygamous. Some species, like Vulcans, had a telepathic bond which formed between mates. (TOS: "Amok Time")
Many species had complex interactions and communications involved in approving or rejecting a potential mate; chemical adaptations such as attractive pheromones were also evolved by some lifeforms, such as Orions. (ENT: "Bound")
Deltans were also known to project a strong sexual presence even without physical contact, which might have included pheromones and some subconscious telepathic elements. The effects were sufficiently strong as to influence other species. (Star Trek: The Motion Picture)
This drive could also lead individuals to enter a relationship or mate for reasons of satisfaction or emotional fulfillment rather than procreation. Individuals of many species were also known to enter into homosexual relationships. Many individuals encountered in the mirror universe were 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, were known to enforce laws prohibiting the occurrence of sexual acts considered deviant by the majority of the population. In their case, any individual who adopted a gender was given psychotectic treatments to restore them to the species' androgynous norm. (TNG: "The Outcast")
In the 24th century, Starfleet personnel apparently required 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, eventually, Quark removed his clothing to prove that he was 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
A cut line in "Paradise" had the self-proclaimed philosopher Alixus claim that she had a lot to say about sexuality, which she believed would shock someone as repressed as Benjamin Sisko seemed to her. This apparently included the acceptability of sexual procurement.
Homosexuality in Star TrekEdit
George Takei recalled what Gene Roddenberry told him when he asked why there were no queer characters on Star Trek: "He said 'I'm treading a fine tight wire here. I'm dealing with issues of the time. I'm dealing with the civil rights movement, the Vietnam War, the Cold War, and I need to be able to make that statement by staying on the air.' He said, 'If I dealt with that issue I wouldn't be able to deal with any issue because I would be canceled.'"  50 years later, Takei's character Hikaru Sulu, a role inherited by John Cho, was revealed to be homosexual in Star Trek Beyond.
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" never came to fruition in the series in which they appeared.