Judaism took a dim view of anything that did not help to increase the progeny of Jews, and homosexuality and Onanism do not particularly contribute to the cause of filling the world with descendants of Abraham, Isaac, and Jacob. But it may be that God was angry that mobs were gang-raping visitors to the towns. I mean, God didn't vaporize any of the city-states of Greece, where homosexuality was rampant.
What about Atlantis? :-D