What does Genesis 12:17 mean?
After Abram's plan to use deception to protect himself fails, the Lord steps in. God had made promises to Abram, and God would not allow Abram's faithless choice keep Him from keeping those promise. This, along with the fact that Pharaoh almost certainly had multiple wives, suggests that he never had an opportunity to consummate his marriage to Sarai.To prevent catastrophe, and to rescue Abram from his own stupid scheming, the Lord afflicts Pharaoh's household with great plagues or diseases. Some scholars understand these plagues to be diseases of the skin. The Egyptians, though superstitious people, would have understood correctly that such plagues were a punishment for sin.
Apparently, through this affliction, Pharaoh comes to understand that Sarai is actually Abram's wife and not merely his sister. The Bible does not say what process of investigation led to that knowledge. His response to that revelation is found in the following verses.