Abimelech the king didn’t touch Sarah Abraham’s wife, but in his heart he did and was guilty. Even if Sarah had been Abraham’s sister and not his wife, Abimelech had no right to take her into his harem against her will. God took Abimelech and his entire household to court, and they were judged to death if the king didn’t make it right and compensated for mistreating Sarah.
As a warning to the king, God closed the wombs of all in the kings household, no women there got pregnant anymore. This was serious and the king got the message and made Abraham even richer then he already was.
The king payed Abraham a thousand silver coins to honor that Sarah was Abraham’s wife and to be respected and not touch by anyone. The king also gave Abraham more cattle and male and female slaves and he gave Abraham the right to settle and let his animals feed anywhere in the king’s country.
Then Abraham prayed to God for the king and his household and then God healed him and his wife and his maids and they again could give birth to children. Abraham was the prophet of God and he had the prayer power that “moved God”. This is the way it works even today; through God’s word, Jesus, in our heart we got the power of prayer, even for people that don’t know God.