LGBT in the Ottoman Empire
LGBT in the Ottoman Empire were the practices, tendencies and cultural assessments of LGBT that were deployed in the Ottoman Empire. In the Ottoman Empire, concepts as 'lesbian' or 'gay' did not exist. Instead of these concepts, terms as active 'sodomy' and passive (me'bun) were used. The legal concept of gender in the Ottoman Empire consisted of two genders, male and female. Although heterosexuality was necessary for the continuation of the lineage of the Ottomans, homosexuality was culturally associated with love. Adolescent men may have desired older men or women at that time, after puberty however, they were expected to desire young boys or women. If they were both passive and active, they were also called out for heresy. Terminology 

Devshirme – the practice of gathering young "promising" boys from Christian families. The children would be victims of sexual molestation and pederasty. This horrified the Christian parents to the point of mutilating their children to make them less attractive to Ottoman inspectors. Hammam – traditional Turkish bathhouse. In his work Sexuality in Islam, Abdelwahab Bouhdiba cites the hammam as a place where homosexual encounters in general can take place. He notes that some historians found evidence of hammams as spaces for sexual expression among women, which they believed was a result of the universality of nudity in these spaces. Hammams have also been associated with male homosexuality over the centuries and up to the present day. Gulampare – old Turkish term for "male-lover". Köçek – Term for male dancers, typically a handsome young male slave effeminate dancer (rakkas), who usually cross-dressed in feminine attire, and was employed as an entertainer. Yamak - volunteers for the devshirme. Yenicheri – literally "new troops", also known as janissaries. Famous slave soldiers. Zenpare – old Turkish term for "woman-lover". The History of Decriminalization of Homosexuality in The Ottoman Empire

Prosecution of homosexuality
The question of whether homosexuality is adultery, that is, whether it is punishable according to Islamic law, has been discussed by the ulama  for a long time. This is because homosexual intercourse is not described as much as adultery in the Qur'an. The official sect of the Ottoman empire is the Hanafi school. For this reason, the punishments in the Ottoman Empire are similar to the rules of Imam Hanafi. According to Imam Abu Hanifa, the crime of adultery and the crime of sodomy are different crimes. Therefore, the penalties are also different. While the penalties on this subject were found in the classical period, such as the laws of Selim I and the Kanuni law, there is no regulation on this subject in the Tanzimat-era laws (the laws of 1840, 1851 and 1858), which nullified all previous laws. Pre-Decriminalization (1800-1858) 
Prior to 1858, Ottomans did not base sexual identities on attraction to a specific gender but distinguished between active and passive partners, often distinguished as "the lover" and "the beloved". Therefore, choice of a partner was merely based on taste and not on sexual identity. However, marriage between a man and a woman was the only acceptable form of a legitimized relationship. Thus making it illegal for people to openly have relationships with partners of the same sex. If one were to express a homosexual relationship in public, society would retaliate in exclusion. During this time, some Ottoman men were executed for sodomy including two boys in Damascus in 1807. Decriminalization (1858) 
In 1858, the Ottoman society constructed a reform to their penal code that was fairly similar to the 1810 French Penal Code. The 1858 Ottoman Penal Code stated the following:

Art. 202—The person who dares to commit the abominable act publicly contrary to modesty and sense of shame is to be imprisoned for from three months to one year and a fine of from one Mejidieh gold piece to ten Mejidieh gold pieces is to be levied (Penal Code of the Ottoman Empire,1858). This statement is a translation from Article 330 of the French Penal Code which also decriminalizes homosexuality. Such a statement only partially decriminalizes homosexuality, making it legal for private same sex relationships while still holding public homosexual relationships to be unacceptable. During this period of time, it is speculated that most homosexual relationships took place behind closed doors. In private hammams, individuals were free to express their feelings and emotions in a comfortable safe space. However, once an individual left that safe space, the acts one indulged in were not permitted to be spoken of in society. Post Decriminalization (1858-1900s)  
By the late 19th century homosexual contact started to decline and the focus of desire turned to young girls. Ahmet Cevdet Pasha stated: "Woman-lovers have increased in number, while boy-beloveds have decreased. It is as if the People of Lot have been swallowed by the earth. The love and affinity that were, in Istanbul, notoriously and customarily directed towards young men have now been redirected towards girls, in accordance with the state of nature." Research shows that the decline is in close relationship to the criminalization of homosexuality in the Western world, which followed repression of the queer community. Homosexuality among the Ottoman elite 

Within the classic Ottoman empire, homosexuality was not always rejected. The Ottoman prince Cem Sultan, who lived in France in the 1480s, wrote a qasida (ode/poem) about homosexual relationships with French men. In the 18th century, the elite in Ottoman society created a system where they were able to generate armies and partake in homosexuality. The Sultan's armies received masses of yamak (volunteers) that wanted the privileges of being a part of the system, especially the exemption from taxes. The yamak, while being trained and schooled, were also expected to be enjoyed by the yenicheri(soldiers). The yamak are described to have been housed separated by gender where the Sultan was in charge of regulating the daily living and learning conditions of the children. The Venetian envoy Benedetto Ramberti described the system inside these houses explaining in detail that "there are about five hundred youths aged from eight to twenty years, who reside in the palace and are the delight of Signor… They never leave the aforesaid palace until they have reached the age when the Signor thinks them fit for offices… Each ten of them is guarded by a eunuch called Kapu-oghlan [gate-youth], and each has a slave’s frock, in which he sleeps rolled up in such a manner that he does not touch another who may be near him." The young yamak inside the palace school experienced living in a single sex environment and were greatly discouraged from engaging in heterosexuality. Once they grew into a mature age, the Sultan granted their graduation and they went on to live on as a soldier. Homosexuality in Ottoman literature 

Homosexuality was not a taboo in the classical Ottoman period. For this reason, homosexual relationships are a subject discussed in classical literary culture up to the 19th century. However, homosexuality became taboo with the beginning of the westernization of the Ottoman Empire and the later establishment of the republic. The Ottomans did not have the same concept of homosexuality as we understand it today. The word homosexuality was introduced during the Turkish Republic. The most preferred form of writing and poetry in classical culture was the gazel. During this time within the Ottoman Empire, it was very popular to write about affection/love for young boys in this kind of poetry. The gazel is not only written for the imaginary lover, but is also used to attract the lover's attention and to make yourself attractive to that lover. Contrary to popular belief, the homosexual relationships in these poems is not just between two different generations. This can be seen not only in the poetry of famous poets, but it also appears in the tradition of Sufi literature. For example, Taşlıcalı Yahya states in his poems that he does not like the love of the opposite sex. According to him, male love is superior and purer than female love. One of the most famous gay writers in the Ottoman Empire is Enderûnlu Fâzıl. This poet frequently writes about his homosexuality and he is not ashamed of this. Fazıl has five books that have survived: Defter-i Aşk, Hubanname, Zenanname, Çenginame and Divan. In Defter-i Aşk, he tells about his own (homosexual) love life. Another book of him is the book Hubanname which talks about the beauty of men from different nations of the world. In the book Zenanname the beauty of women of different nationalities is described. In another book of Fazıl Bey the book Çenginame, the famous male dancers of Istanbul are described. Homosexuality in the Ottoman Empire is not only between men. Although less visible than between men, sexuality between women has also been the subject of poetry. In the poems of female poets it is usually not clear whether the lover is a woman or a man. Mihri Hanım, a high educated unmarried female poet, is an interesting example of this. In her poems she pretends to be a man in love with a woman, but she is a woman herself too. Some poets focus only on the love between women, some only on love between men, and some on both. In short, there is a great literary debate among poets whether the most beautiful form of love is female love or male love. Hamse-yi ‘Atā’ī 

Nev'izade Atayi was an Ottoman poet of the 18th century who wrote beautiful manuscripts detailing stories of moralities, trites, and same-sex relationships. In his manuscript titled Hamse he uncovers major themes regarding the Ottoman Empire. The poems detail stories encompassing parties inside the Imperial Court, social values of the century, moral and ethical codes, and same sex relationships. It is in the fourth part of Hamse where the story follows two young men and their travels around Istanbul. As the two young male characters are traveling by sea to Egypt, they are captured and enslaved by European soldiers. While they are enslaved, the European kidnappers fall in love with their prisoners. See also 
 History of human sexuality
 LGBT rights in Turkey

References 

Ottoman Empire
Social history of Turkey
Ottoman Empire
LGBT history in Asia
History
LGBT and Islam