"For in the simplicity of your heart you have done this" (Genesis 20:6) — that you thought she was his sister, because you asked everyone and they said, "She is his sister." But you did not act with the cleanness of your hands, for a guest who comes to a city — one questions him about matters of eating and drinking, or one questions him about matters of his wife. "And I also withheld you from sinning against Me" (Genesis 20:6). A parable: like a man riding upon a horse, with a child thrown down before it. They all began to say, "How great was the understanding in this horse, that it did not trample the child!" They all began to praise the horse. The man riding upon the horse said to them, "Do not praise the horse — were it not that I drew back the rein and did not let it go forward, it would have trampled him." And so the Holy One, blessed be He, said: Let no person praise Abimelech that he did not touch Sarah; rather, let all praise Me, who warned him. Therefore it is said, "And I also withheld" etc. Abimelech said to the Holy One, blessed be He, "And who will inform Abraham that I did not touch her?" The Holy One, blessed be He, said to him, "For he is a prophet" (Genesis 20:7).
Why God Withheld Abimelech From Sinning Against Sarah
Midrash Aggadah, Genesis 20:6
כי בתם לבבך עשית זאת. שחשבת שהיא אחותו, לפי ששאלת לכולם והם אמרו אחותו היא, אבל לא עשית בנקיון כפיך, שאכסנאי שבא לעיר על עסקי אכילה ושתייה שואלין אותו או על עסקי אשתו שואלין אותו: ואחשוך גם אנכי אותך מחטוא לי. משל לאדם רוכב על סוס ותינוק מושלך לפניו, התחילו הכל אומרים כמה דעת גדול היה בזה הסוס שלא דרס את התינוק, התחילו הכל משבחין את הסוס, אמר להם האיש הרוכב על הסוס לא תשבחו לסוס, אלמלא שאני משכתי ברסן שלא הנחתיו ללכת היה דורסו, וכך אמר הקב"ה לא יהיה אדם משבח לאבימלך שלא נגע בשרה, אלא לי יהיו הכל משבחים שהזהרתיו, לכך נאמר ואחשוך גם אנכי וגו': אמר אבימלך להקב"ה ומי מודיע לאברהם שלא נגעתי בה, אמר לו הקב"ה כי נביא הוא: