Then Abimelech called Abraham and said to him, "What have you done to us? And how have I sinned against you, that you have brought on me and my kingdom a great sin? You have done to me things that ought not to be done." And Abimelech said to Abraham, "What did you see, that you did this thing?"
Sometimes God will use the least likely people and circumstances to rebuke us. Abraham has fallen into a sinful pattern. His wife was indeed his half-sister, and was considered very beautiful by the culture (even in her nineties!). Abraham had pulled the stunt of passing her off only as his sister to Pharaoh in Egypt. Now he does the same when they live under Abimelech's rule. And when Abimelech takes Sarah into his harem, Abraham does not stop it.
Personally, I find the whole episode a strange weakness in Abraham. He could trust God to lead his homegrown commandos in battle, but he could not trust God with the sanctity of his own marriage! But our sins usually defy expectation. Abraham gives some explanation for his actions: He acted out of fear to turn a half-truth into a convenient cover. But the reality was that Abraham sinned by so doing.
God uses the pagan king that Abraham feared to point out the patriarch's great sin. And I am sure that at this confrontation, Abraham trembled. He feared confrontation with this king, but now his own deceptions had created it. And the king is very upset. Fortunately, God had supernaturally intervened on the part of Abraham and Abimelech was ready to humbly mend things with Abraham.
There have been a few times in my life where God has done the same with me. I remember being humbled on issues of integrity by a boss at a bank who would not let even $20 go unreconciled on an account that moved tens of thousands of dollars a day. I remember having a factory supervisor be used by God to rebuke me when in a fit of temper I used language unbefitting a Christian. Those were not easy messages to hear, but God used them, and I vividly remember them still. I have a feeling Abraham learned the same way from this episode.