While Abraham was being visited by three angels, he was told that his old wife would have a son. God decided to also tell Abraham about his plans for the cities of Sodom and Gomorrah. The Bible tells us that God had heard that the people of those cities were doing something "very grievous" (Genesis 18:20) so God was going to go down and see if things were as bad as he had heard. Why an all-knowing God needed to go "see for himself" is a mystery. Abraham cautiously proceeded to make a deal with God at that point, sort of like a biblical "The Price Is Right," the conversation going something like this:
Abraham: Hey, God, you wouldn't destroy the righteous along with the wicked would you? Uh...let's say there were fifty righteous people in the city, wouldn't you spare the lives of the innocent by not destroying the entire city? That wouldn't be very Godly of you, I mean...to punish the righteous as if they were wicked. You're the judge of all the earth, shouldn't you do the right thing?
God: If I find fifty righteous, I will spare the city for their sake.
Abraham: Now, look at what I've done...me a lowly piece of dirt, who dares to question God. But let's say there were only five missing from the fifty. Would you destroy the entire city just because there were five missing?
God: I won't destroy the city if I find forty five righteous in it.
Abraham: Well, what if there are only forty?
God: I won't destroy it if there are forty
Abraham: Now, don't get angry at me, but what if there are only thirty righteous people there?
God: I won't destroy it if I find thirty there.
Abraham: Well, I've put my foot in this far, let's say there are only twenty righteous...
God: I won't destroy it if I find twenty.
Abraham: Don't get angry and I will ask this last time. What if there are only ten righteous there?
God: I won't destroy it for the sake of ten righteous people.
(Genesis 18:23-32)
God wasn't able to find even 10 innocent women or children in the two cities. Christian versions of the story claim that God heard the cries of innocent children, apparently God didn't consider these chidlren to be very righteous.
Abraham's nephew, Lot was living in Sodom and two angels came to warn him that the city was about to be destroyed because of its sinfulness. What exactly were these cities doing which was so "sinful?" Because a mob came to Lot's house to try to rape the angels, modern Christians believe it had to do with homosexuality. If homosexuality was the sin of Sodom and Gomorrah, why didn't God destroy the city of Gibeah when they tried to rape a visiting man? (Judges 19:22) The Bible tells us that the sins of Sodom were "pride, fulness of bread, and abundance of idleness" they also didn't "strengthen the hand of the poor and needy" (Ezekiel 16:49). Let's take a look at these supposed sins. Pride, fulness of bread and abundance of idleness suggest that the cities were self-sufficient, they were productive enough as a civilization to not need God. We have already discussed why God would consider self-reliance to be sinful; God wanted to keep man busy. As for not strengthening the hand of the poor and needy, Jesus himself was guilty of that same "sin" when he allowed a woman to waste an expensive ointment on his feet instead of selling it to feed the poor as one of his disciples suggested (Matt. 26:6-11, Mark 14:3-7). These reasons by themselves don't seem sufficient to warrant God sending a special hit-team to destroy them. For the real reason Sodom and Gomorrah were destroyed.
The only people which God considered righteous enough to save from the destruction of the cities was Lot, his wife, and his two daughters. Lot's wife is killed because she dared to look back at the city and Lot's "righteous" daughters turned around and got him drunk and raped him so that they could get pregnant. God's definition of "righteous" apparently has little to do with one's personal morality or actions, since innocent children don't qualify but rapists do.