The Ottomans, who followed the flexible Hanafi school of jurisprudence, were pragmatic about law from the beginning. Decrees issued by sultans introduced fines or prison sentences instead of corporal punishments, rendering the latter often practically obsolete.
Moreover, in the mid-19th century the Ottomans initiated a major Reform (Tanzimat) era, which included the Imperial Ottoman Penal Code of 1858. The French-inspired law was designed to be valid for all Ottoman citizens, regardless of their religion, and remained in practice until the end of the empire with some modifications. It replaced all remaining corporal punishments in Ottoman law with prison sentences or forced labor. It also decriminalized apostasy and penalized blasphemy, or “interference with religious privileges,” with only “imprisonment of from one week to three months” (Article 132).
The penal code’s section on sexual crimes is worth a look, for it is much more liberal than the laws Brunei just began implementing 161 years later.
According to Article 200, for example, “an abominable act” with “a girl who has not yet been married to a man” was an offense — but only when done “by force.” In other words, consensual premarital sex was not a crime.
Extramarital sex, or adultery, was an offense under Article 201 — but to be punished with a prison sentence of “three months to two years,” not stoning to death.
What about homosexuality? The Ottoman penal code didn’t say anything about it. John Bucknill and Haig Utidjian, who translated the law into English in 1913, noted, “It will be observed that unless committed with force” or upon a minor, “sodomy is not a criminal offense under the Ottoman Penal Code.”