Hashem commands Avraham to go to land of Cana’an: And the Lord had said to Avram, Get out from your country, and from your family, and from your father’s house to a land that I will show you. Soon after Avraham arrives, though, a severe famine forces him to leave southward to Egypt.
As he approaches Egypt, he turns to Sarah, his wife, saying, now I know that you are an attractive woman; when the Egyptians see you, they will say, ‘It’s his wife’ and they will kill me and keep you alive. [He then instructs her:] please say that you are my sister, so that they will favor me because of you, and that my life be spared thanks to you.
As planned, Sarah says that she is Avraham’s sister, and, indeed, the Egyptians favor Avraham with gifts on account of her.
Sarah, though, is taken to the house of Pharoah, but Hashem inflicts him and his household with a severe disease, causing Pharoah to return Sarah to her husband unviolated.
The Or HaChaim Hakodesh, Rabbi Chaim ben Mosheh ben Atar , commenting on [just] now, I know that you are an attractive woman, writes “Our Sages tell us that this speaks to the [extreme] modesty persisting between [Avraham and Sarah,] but we still need to understand why Avraham told this to her?”
The Or HaChaim answers his own question thusly: “Since Avraham wished to instruct Sarah to say that she was his sister, he anticipated that Sarah would ask him why he had placed her in such danger in the first place? He should not have brought her to a place like this. And even though the truly righteous trust in G-d, nonetheless, we have a rule dictating that “one that may not rely on miracles” (Tractate Pesachim 64b); Go and study the episode where Samuel demurs to G-d saying that “Saul will hear [about it] and kill me” (1Samual 16:2). Therefore, Avraham excuses himself, saying [honestly], that only now has he realized that Sarah was attractive, [meaning] that had he realized earlier he would, indeed, not have brought her to Egypt…”
“But why did Avraham pay attention [to her physicality] now”, the Or Hachaim goes on to ask? “Because… as he got close to Egypt, he acquired the knowledge that the King would take unto himself the most beautiful of women, so he payed attention and recognized this feature in her.