The Ottoman Caliphate didn't decriminalize homosexuality in 1858 nor did it legalise it.
It decriminalized consensual sex between males. Consensual sex between females had been theoretically decriminalized since 1545, with the creation of the criminal code of Sultan Suleiman.
The legal status of "homosexuality" as a concept is much more expansive than sex acts - specifically anal penetration - between males, encompassing rights and freedoms for people of all genders such as the legal recognition of relationships, the right to family, adoption, inheritance, religious sanction, access to education, healthcare and cohabitation, freedom from violence, the ability to congregate and so on.
There is little if any scholarly evidence in English pointing to the motivation for decriminalization. Though I cannot substantiate this without further research, it is possible it resulted from Abdulmajid's usage of French codes - and foreign influence and pressure - as it served as his model for the 1858 Criminal Code.
Gulnihal Bozkurt, who has catalogued the various European codes adopted by Ottoman reformers, points out that the 1858 Ottoman Criminal Code was based on the French Criminal Law of 1810. France decriminalized sodomy in 1791. He also catalogues how the Ottoman Criminal Code was further reformed in 1911, this time based on the Italian Zanardelli Criminal Code. In the south of Italy, sodomy had been decriminalized since the adoption of the Napoleonic Code in Sardinia. It was legalized in the North of Italy in 1889 with the Zanardelli Code. Sodomy was never re-criminalized in the Ottoman Empire, nor in the newly established Republic of Turkey, which used the Zanardelli Code as the model for its 1926 Criminal Code and none of the laws in operation in the Middle East regarding sodomy seem to stretch back to older Ottoman regulations.
The Ottomans and later Turks borrowed provisions from a number of countries, among them Switzerland - which criminalized sodomy until 1942 and Germany - which did so until 1969, though not in their criminal codes. Still, it is unclear whether or not the importation of the French criminal codes were purposefully chosen to accord with the Ottoman position on same sex relations as non-offenses.
As an aside, the status of same-sex sex acts in the various schools of jurisprudence or madhahib (sing. madhhab) is variable and more importantly, just because a particular madhhab takes a dim view of it, does not mean that that position was reflected in court. Many legal historians, among them Elyse Semerdjian, Leslie Pierce and Amira Sonbol have compared juridical writings to court records in Syria, southern Turkey and Egypt respectively, to demonstrate the gaps between the literature and actual rulings as they relate to gender. A similar analysis for same-sexual relations would be particularly valuable. Semerdjian's study of illicit sex in Ottoman Aleppo shows the rumblings of such a development, though it does not focus on same-sexual relations per se.
One point to be clear on. They did not have other rights, whether before or after and continue to struggle to this day for basic protections. The hallmarks of what we typically consider as constituting decriminalization of "homosexuality" just aren't there: there are no anti-discrimination laws in place, whether historically or in the present moment and same-sex marriage/domestic partnerships/adoption/ivf/surrogacy are not legal nor have they ever been. There aren't any laws against assembly for gay people, such as at gay bars or pride parades, however nowadays the government regularly rejects permits for demonstrations and violently attacks them, while victims have no legal recourse. Historically, though, tolerance of queer spaces has vacillated - but again, no specific legal protections have existed.
Speaking first to the suspension of the Hadd (Islamic punishments); the Ottoman Empire had done this before, as had the second Caliph (a companion to the Prophet Muhammed) Umar ibn al-Khattab, although not actually for the decriminalization of homosexuality.
The Qur'anic verse 2:185 allows for suspension of the law in exceptional situations. It speaks about adherence to Ramadan and Allah's will that you be at ease and not take on undue burden to glorify God. Although the secular reforms of the Tanzimat and the dire straits the Ottoman Empire found itself in was a bit of a stretch, this is the source of their justification.
The duty of spreading laws across the empire was the responsibility of the Shaykh ul Islam (held by a couple individuals throughout this reformist period), who agreed that these new reforms were necessary in such times of turbulence and diminishing power for the good of the people. This idea of being for the good of the people (maslaha) is not part of shari'a but general Islamic jurisprudence (fiqh).
Now for the historical context. The Ottoman Empire has historically been a very pluralist society, accepting members of all walks and religions. Although there were certain restrictions such as the jizya (head tax on non Muslims/dhimmi) the millet system of rule allowed for autonomous rule by fairly independent religious communities. However, during the 19th century the Ottoman Empire was faced with pressure from both inside and out, losing ground, losing power and finding itself further and further behind the advancements in Europe. I'm not going to get to off track with the reasons for the reforms, but understand that the leaders of the Ottoman Empire were desperate for change and were ready to accept significant reform.
The first of these was the Edict of Gulhane (1839), it prescribed a few things including the right to life for all, but the most relevant piece is that despite it's reforms it still acknowledged Islamic principles and law. The Ottoman Empire continued to relieve itself of these religious restrictions though, including abolishing the death penalty for apostasy four years after the edict. The Ottomans as a whole though weren't that fanatic to begin with:
"Throughout Ottoman history only one case of rajm (stoning) was decided and carried out (in 1680). This happened in a period of extreme religious fanaticism and it encountered such opposition that it was not repeated."
The next big reform took place in 1856, known as the Imperial Rescript (Hatt-i Humayun). This is the one that decriminalized homosexuality. It completely removed any reference to Islamic principles and law. It's seen as having taken much of it's influence from the French and British who had just fought the Crimean War alongside the Ottomans.
So, why bother decriminalizing homosexuality? It was prevalent. While Europe often perceived the Turks as lustful and addicted to the filthy pleasures of pederasty, it was not to such an outrageous degree. In fact back in the 18th century a man Mehmet "Efendi" was traveling in Paris and his hosts knowing he was a 'lustful turk' thought to show him what Paris had to offer in rentable boys
After being shown around the Palais Royal Marketplace at night he challenged the image of Turkey being especially notable for pederasty arguing that with, "1500 boys exclusively occupied in sodomy" and, especially shockingly, their availability and prices advertised on printed cards, it was far more blatant in Paris than anywhere in the Ottoman realm.
It did exist though and was simply addressed as part of secularization/reformation. The French, one of the greater influences on the 1858 Rescript had already done so in 1789. This also was solely applied to men because female sexuality was already decriminalized, it was often surmised that female homosexuality was prevalent in harems and bath houses. However, most of the sources on that are foreign assumption and the well known Lady Montagu, one of the only sources to actually enter a bathhouse, denied that it occurs in bathhouses during her first and only visit to one(which was her only mention of homosexuality in the entirety of her letters).
Stephen O. Murray Historical Reflections / Réflexions Historiques Vol. 33, No. 1, Eighteenth-Century Homosexuality in Global Perspective (Spring 2007), pp. 101-116
Islamic Homosexualities: Culture, History and Literature edited by Will Roscoe, Stephen O. Murray
Great answers start with great insights. Content becomes intriguing when it is voted up or down - ensuring the best answers are always at the top.
Questions are answered by people with a deep interest in the subject. People from around the world review questions, post answers and add comments.
Be part of and influence the most important global discussion that is defining our generation and generations to come