What does Genesis 20:18 mean?
The previous verse reveals that in response to Abraham's prayer for their healing, God restored the ability of Abimelech's wife and his female slaves to bear children. This verse concludes that God had closed all the wombs of all the women in the house of Abimelech because of Sarah. She had been taken in as a wife, by Abimelech, who was deceived by a lie told by Sarah and Abraham (Genesis 20:2–3).This established two points that are important when interpreting this incident. First, Sarah must have been in Abimelech's household for a while before God appeared to him in the dream. She had to be there long enough for it to become apparent that the women of the household could not bear children. That's not something one can realize in a few short days, or even weeks.
Second, this shows us once again that God exercises complete control over fertility, giving and withholding children as He sees fit. Psalm 127:3 indicates that children are a gift from the Lord. He sometimes withholds them in judgment, as He did here, or until the time is right, as will happen with the birth of Isaac in the following chapter. At still other times, He withholds children without explanation or condemnation. In all cases, His people are called to trust the Father's timing, His grace, and His love.