Abraham and Sarah agreed to declare to the king of the Philistines that they were siblings, and so the king took Sarah, but the Lord revealed to the king that Abraham and Sarah were actually married.
Then the king rebuked the couple, and to show that he was clear of any wrongdoing, Moses wrote,
“Then to Sarah [the king of the Philistines] said, ‘Behold, I have given your brother a thousand pieces of silver; indeed this vindicates you before all who are with you and before everybody.’ Thus she was rebuked” (Genesis 20:16).
In this way, everyone could know that the king had not touched this holy woman, and that they had not been together in a sexual way.
Abraham had thought that the fear of God was not in the place, but Abraham and Sarah found out otherwise, setting themselves up for potential trouble, but the God of heaven was with them, and protected everyone involved that no one might sin against Him, because in general, they all wanted to do the right thing.