"Then the men rose from there and looked toward Sodom, and Abraham went with them to send them on the way. And the LORD said, 'Shall I hide from Abraham what I am doing, since Abraham shall surely become a great and mighty nation, and all the nations of the earth shall be blessed in him? For I have known him, in order that he may command his children and his household after him, that they keep the way of the LORD, to do righteousness and justice, that the LORD may bring to Abraham what He has spoken to him'" (Gen. 18:16-19).
The purpose of the visit from God and these two angels (cf. 18:22; 19:1) was primarily twofold: (1) To communicate once again regarding the coming son that would be born to Abraham and Sarah, and (2) To bring judgment against the wicked cities of the plain. Regarding the latter purpose, God desires to communicate with this righteous man, Abraham, about these cities before reigning down fire and brimstone from heaven upon them. Thus, not only would He bring judgment against them, but He would use it as an instructive opportunity for Abraham and his descendants regarding the need for righteous and just living.
"And the LORD said, 'Because the outcry against Sodom and Gomorrah is great, and because their sin is very grave, I will go down now and see whether they have done altogether according to the outcry against it that has come to Me; and if not, I will know'" (Gen. 18:20,21). This is certainly accommodative language for Abraham's benefit. God, being omniscient, knew full well of all the wickedness going on in Sodom, Gomorrah, and the other cities of the plain. He didn't need to come down in a bodily form and investigate what He knew perfectly. But, He would do so for the sake of Abraham and the patriarch's sense of justice. The two angels accompanying God will soon depart and head toward Sodom to investigate. God, however, would remain with Abraham a little while longer, to dialogue with him about what was about to happen.
"Then the men turned away from there and went toward Sodom, but Abraham stood still before the LORD. And Abraham came near and said, 'Would You also destroy the righteous with the wicked? Suppose there were fifty righteous within the city; would You also destroy the place and not spare it for the fifty righteous that were in it? Far be it from You to do such a thing as this, to slay the righteous with the wicked, so that the righteous should be as the wicked; far be it from You! Shall not the Judge of all the earth do right?'" (Gen. 18:22-25).
Abraham's compassionate nature is seen here as well as his sense of justice. He didn't believe it would be right to destroy the righteous with the wicked, though he believed that Almighty God would do what is right. He wonders if God would spare the entire city for the sake of 50 righteous residents therein?
"So the LORD said, 'If I find in Sodom fifty righteous within the city, then I will spare all the place for their sakes.' Then Abraham answered and said, 'Indeed now, I who am but dust and ashes have taken it upon myself to speak to the Lord: Suppose there were five less than the fifty righteous; would You destroy all of the city for lack of five?'" (Gen. 18:26-28). Abraham is both wise and reverent here. He knows who he is and who he is speaking to! Almighty God and Abraham are certainly not equals; this Abraham knows full well. He careful asks: What about 45, God? Would you save the city for 45 righteous souls? God again answers in the affirmative. Abraham proceeds to ask four more times: What about 40, 30, 20, 10? In each case, God speaks that He will not destroy the city if that many righteous souls reside there. "So the LORD went His way as soon as He had finished speaking with Abraham; and Abraham returned to his place" (Gen. 18:33). Abraham said it would be his last question, and God left immediately thereafter. We are left wondering: Would God have gone lower or would He have left anyway at this point? It is impossible to know. We know there was at least one righteous person living in Sodom (i.e., Lot; cf. II Pet. 2:7). Based on their recorded behaviors, it is difficult to say whether God considered the rest of his family righteous or not. Sadly, there were not 9 other righteous inhabitants of Sodom besides Lot or else God would have kept His word to Abraham and spared the city. There is a powerful lesson here for us to ponder today: Righteous followers of Christ have a good influence on their culture directly and indirectly. There is a direct influence in the sense of one's daily interactions with the ungodly for their good. There is an indirect influence for good in the sense of God potentially sparing a city or nation today because of the righteous souls that dwell there. Friends, may we always strive to be light in a world of darkness--it matters!