Twice Abraham acts to save Sodom.
His first effort comes in Genesis 14, when a Mesopotamian army plunders the city. They seize all of Sodom’s goods and food. They also capture a portion of Sodom’s population to enslave them. A man who manages to escape reports this news to Abram (not yet Abraham). Upon hearing that his nephew Lot was included among the captives, Abram gathers 318 trained men to pursue the Mesopotamian army on their way back to Mesopotamia. He stages a surprise attack at night, an attack that sends them running. Having recovered all that was stolen, Abram then returns the captives and possessions of Sodom to the king of Sodom. Their city is thus restored, and Sodom lives to see another day.
His second effort comes in Genesis 18. By this time, the sins of Sodom have become so grievous that God goes down to see if their actions are as bad as the outcry that has reached Him. And indeed, they are. Once again Abram (now Abraham) steps forward to save Sodom. He asks God, “Will you sweep away the righteous with the wicked?” Abraham begins to bargain, asking God to spare Sodom if just 50 righteous citizens can be found. And if not 50, then how about 40? How about 30? 20? Okay, how about just 10?
Abraham is doing some mental math here. He knows Lot and his wife make two; add Lot’s two daughters plus two sons-in-law––there’s six. And surely Lot has a couple of righteous friends, right? We can get to 10!
God agrees to the terms and Abraham returns home. At this point, it looks as if Abraham has done it again; it looks as if he has saved Sodom one more time. However, not even 10 righteous individuals are found in the entire city! Consequently, Sodom's people and possessions are destroyed once and for all by fire and brimstone raining down from the sky. This time around, the city of Sodom is not saved.
Note this interesting parallel:
The first time around, Abram hears the outcry of a survivor, a man who reaches Abram to tell him how dire the situation is. Abram, in a surprise attack, strikes the Mesopotamians who have captured and enslaved the people of Sodom.
The second time around, God hears the outcry of the sinfulness of Sodom. It reaches Him to tell Him how dire the situation is. God, in a surprise attack, strikes the wickedness of the people, a wickedness that has captured and enslaved the people of Sodom.
In both cases, Abraham does whatever he can to save Sodom. But how is it that Abraham manages to save Sodom the first time but fails to do so the second time? I think there are some key differences:
Abraham could rescue Sodom from the Mesopotamians.
Abraham could NOT rescue Sodom from itself.
Abraham could rescue Sodom from the injustice of their demise.
Abraham could not rescue Sodom from the justice of their demise.