God stops Abimelech in a dream from having any relationship with Sarah.
Then in Genesis 28:6 (here @ Bible Gateway), God speaks to Abimelech. Two observations
God’s sovereignty extends to the choices men make on baser issues, like sex. The Lord can prevent or, as an implied corollary, cause a man to choose a course of action.
Abimelech did not sin against Abraham by taking Sarah, he sinned against God.
We may choose, but our choice is under God’s sovereignty. If we choose to sin, our sin is against Him.