Because they were perhaps more enlightened than some in the 20th century? Progress has not be linear or consistent on this issue. From Wikipedia:
In ancient Assyria, homosexuality was present and common; it was also not prohibited, condemned, nor looked upon as immoral or disordered. Some religious texts contain prayers for divine blessings on homosexual relationships.[85][86] The Almanac of Incantations contained prayers favoring on an equal basis the love of a man for a woman, of a woman for a man, and of a man for man.[87]
In Greater Iran, homosexuality and homoerotic expressions were tolerated in numerous public places, from monasteries and seminaries to taverns, military camps, bathhouses, and coffee houses. In the early Safavid dynasty (1501–1723), male houses of prostitution (amrad khane) were legally recognized and paid taxes.
Some scholars argue that there are examples of homosexual love in ancient literature, like in the Mesopotamian Epic of Gilgamesh as well as in the Biblical story of David and Jonathan. In the Epic of Gilgamesh, the relationship between the main protagonist Gilgamesh and the character Enkidu has been seen by some to be homosexual in nature.[88][89][90][91] Similarly, David's love for Jonathan is "greater than the love of women."[92]