For Europe, it became mainstream with the ascendency of Christianity, which brought with it the traditional Jewish abhorrence of homosexuality. For the Muslim world, opinions on the seriousness of homosexuality varied from era to era and region to region, but became overwhelmingly serious and negative in the 18th and 19th centuries with the rise of Islamic revivalist movements like the Salafis and Wahhabis.
Outside of those two influences, European colonialism brought Christianity and pseudo-rational abhorrence of homosexuality to many colonized areas in the 19th century, influences which last until the modern day.
In eras or places before those influences, opinions on homosexuality varied wildly.