What is the proof that Sarah did not become pregnant from Avimelech?
(17,21) “And My covenant I will establish (אקים) with Yitzchok whom Sarah will bear for you at this time next year.”
The midrash comments on this posuk “that year was a leap year”, and I saw in a certain sefer the following explanation:
The scoffers of that generation said that Sarah became pregnant from Avimelech, but there is a refutation of this false idea from the posuk in parshas Vayeira (18:10) “I will surely return to you at this time next year, and your wife Sarah will indeed have a son”. Rashi explains that the announcement took place at the time of Pesach, and Yitzchok was born the following Pesach. After this announcement the angels went to S’dom and Avrohom went to Gerar, where Sarah was taken by Avimelech.
Now, the gemora in Yevomos 80b teaches that if a woman whose husband has gone abroad gives birth within twelve months of his departure, since it is possible for a foetus to stay in the womb for twelve months we do not say that the child is a mamzer. But if she gives birth after twelve months, since it is impossible for a foetus to remain so long in the womb she must have had committed adultery and thus the child is a mamzer.
Therefore, since Sarah was taken by Avimelech at the time of Pesach and the following Pesach she gave birth, if that year had not been a leap year there would have been a possiblity that she had become pregnant from Avimelech and the foetus stayed in her womb for twelve months. But since that year was a leap year she clearly could not have become pregnant from Avimelech since she gave birth more than twelve months after she had been taken by him.
Some of the commentaries comment that the initial letters of the word אקים spell out אשר קידש ידיד מבטן - “Who sanctified His beloved from the womb”, to allude that Hashem testifies that Yitzchok was holy from the womb and was not from Avimelech. And the proof for this is the fact that that year was a leap year.