Avram never intended to place his wife in danger and had not thought that she would be taken to Paroh's palace. This position subdivides regarding what Avram was thinking in acting as he did:
Unaware of Danger
Avram simply did not recognize that going down to Egypt was going to endanger Sarai until it was too late.
Descent to Egypt – Most of these commentators assert that Avram only left the land promised to him by Hashem because the severe conditions brought by the famine left him no choice.3 As such, his actions are not considered problematic. Both Radak and Abarbanel further stress that Avram only planned to move temporarily and was thus not rejecting Hashem's chosen land.
"הִנֵּה נָא יָדַעְתִּי..." – Most of these commentators define the word "נָא" in this verse as "now".4 Avram had either truly never noticed Sarai's beauty beforehand,5 or only first appreciated its ramifications now, when contrasting Sarai with the Egyptians.6 It was thus, only on entry into Egypt, that Avram recognized that there was potential danger.7 Radak and Abarbanel maintain that had he known sooner, Avram would never have gone down.
"וְהָרְגוּ אֹתִי וְאֹתָךְ יְחַיּוּ" – According to Radak, Akeidat Yitzchak and Abarbanel, in these words Avram is pointing to the dangers that faced both him and Sarai - for him, death, and for her, an equally terrible fate, to be left alive so as to be raped.
"וְחָיְתָה נַפְשִׁי" - Is his life more important? Radak explains that Avram thought that Sarai would be in worse danger if he were dead rather than alive. Though the Egyptians might take her either way, Avram's presence would shame them into minimizing their base actions, whereas his death would leave Sarai at the mercy of their whims.8
Why a sister specifically? Radak might maintain that Avram thought he could best watch over Sarai if others believed that they were related (but not married). This way they could live together, and their kinship would help ensure that the Egyptians acted with at least a modicum of conscience.9
Lying and leading Egypt to sin – Most of these commentators would likely maintain that lying is not problematic if it will help save a life, and that telling the truth would not have stopped the Egyptians from sinning anyway.10 Akeidat Yitzchak suggests that even Paroh agreed that the ruse was valid in light of the Egyptians' reputation, and that he only complained why Avram had not told him personally the truth.
"לְמַעַן יִיטַב לִי בַעֲבוּרֵךְ" - asking for riches? Radak, Akeidat Yitzchak and Abarbanel explain that this clause is parallel to and defined by the immediately following one, "וְחָיְתָה נַפְשִׁי בִּגְלָלֵךְ".11 It is inconceivable that Avram would desire to get rich off the shame of his wife.12 Moreover, he had no need of riches, being independently wealthy. The only reason he even accepted the later gifts was his fear of displeasing Paroh.13
Why punish Paroh?
Why does Avram repeat the actions in Gerar? The repeated actions in Gerar are difficult for this position as it would be hard to say that there too Avram was taken by surprise.14
Hoped to Avert Danger
Avram's actions were part of a calculated plan which was meant to protect Sarai and prevent her from being forcibly taken by the Egyptians.
Prolong marital negotiations – Most of these commentators assert that Avram meant to act as Sarai's guardian who could negotiate her nuptials,15 and planned to ask for such a high dowry that no one would be able to meet it. During the prolonged discussions Avram would be able to get provisions enabling him to return to Israel before any harm was brought to Sarai.16
Pass Sarai off as married – Chizkuni, instead, suggests that Avram told the Egyptians that Sarai was indeed married but that her husband was overseas. Unable to kill her spouse, and fearful of committing adultery, they would thus leave Sarai alone.17
Hide Sarai – According to Bereshit Rabbah, Tanchuma, and Rashi, Avram was hoping to hide Sarai during their stay.18
Descent to Egypt –
All of these sources justify Avram's decision, but for different reasons:
Test from Hashem – Rashi, Ran and Malbim count the famine as one of Avram's ten trials,19 asserting that Hashem was testing whether Avram would complain when forced out of the land. As such, they assume that Hashem intended Avram to leave and view his acceptance of the situation as a show of faith, not a lack thereof.20
No reliance on miracles – R. Hirsch and Malbim maintain that one is not supposed to rely on miracles,21 but rather do whatever one can to avert disaster naturally.22
Caring for others – The Ran suggests that had Avram only needed to care for himself and Sarai, he would likely not have gone to Egypt, but since he felt responsible for many others and desired to continue his hospitable ways, he chose to go down.
Plan to save Sarai – Ran points out, though, that even the necessity to escape death from famine can not explain nor justify a decision to endanger Sarai's honor, leading him to conclude that Avram descended with a ruse which he thought would prevent such an issue.23
"הִנֵּה נָא יָדַעְתִּי..." – These commentators split, with some24 suggesting that "נָא" means "now",25 and others viewing the term as a figure of speech or a sign of emphasis.26 If the latter, Avram is simply saying, "behold, I know you are beautiful..." as a preface to the discussion of this fact's ramifications.
"וְהָרְגוּ אֹתִי וְאֹתָךְ יְחַיּוּ" – Ran, Ma'asei Hashem, and R. Hirsch assert that Avram is equating the potential fates of both he and his wife; Avram will die, and Sarai be left alive to have her honor harmed. When he requests that Sarai pose as his sister, his purpose is to save them both.
"לְמַעַן יִיטַב לִי בַעֲבוּרֵךְ" - asking for riches? Most of these commentators could say, like Seforno, that Avram is referring to the dowry that he is to ask of the Egyptians who seek to marry Sarai.27 Malbim defends this read by pointing out that the word "בַעֲבוּרֵךְ" means "on your behalf" rather than "because of you" ("בִּגְלָלֵךְ").28
"וְחָיְתָה נַפְשִׁי" - Is his life more important? Avram was not planning on saving himself at Sarai's expense, but rather trying to save both.
Why a sister specifically? For most of these commentators Avram needed to pass himself off as Sarai's brother specifically since only such a relative could negotiate her dowry and push off potential suitors.
Lying and leading Egypt to sin – This position would likely suggest that in cases of potential loss of life, lying is permissible. In addition, according to most of these commentators,since Avram's goal was to push off potential suitors, there is no issue of leading others into sin.
Why punish Paroh? According to Chizkuni, Paroh believed that Sarai was married and nonetheless took her. The fact that he did not know that Avram specifically was her spouse is irrelevant.
Why does Avram repeat the actions in Gerar? Since Avram's plan was actually a logical one which would very likely have worked in most situations, it made sense to try again.29
Self-preservation
Avram's conduct was motivated by a desire to save himself. Placing Sarai in potential danger was justified in face of the supreme value placed on preservation of life.
Descent to Egypt – This approach lauds Avram's decision to escape the almost certain death due to famine rather than stay in Israel and trust that Hashem would save him.31 Since commandments were given to live by, temporarily leaving the land to save one's self is not seen as a transgression but rather as an act to be emulated.
"הִנֵּה נָא יָדַעְתִּי..." – Ralbag does not read any significance into the word "נָא" and assumes that Avram had recognized Sarai's beauty earlier. Avram is simply remarking upon it now in the context of the danger that this fact brings to his life.32
"וְהָרְגוּ אֹתִי וְאֹתָךְ יְחַיּוּ" – According to Ralbag the two phrases are reversals of each other. Avram is telling his wife that the Egyptians will kill him, leaving only her alive, thus emphasizing that the danger is to him personally (rather than to Sarai).
"וְחָיְתָה נַפְשִׁי" - Is Avram's life more important? Though these commentators agree that Avram was placing his life before the honor of his wife, they differ in their justification of this:
Pirkoi b. Baboi asserts that all other transgressions are overridden in order to save a life.33 Even a case of potential danger to life allows one to push off a potential case of forced relations.34
Abarbanel instead suggests that Avram was convinced that Sarai's being taken was inevitable. If so, nothing is gained by Avram martyring himself and it is logical that he should try to save himself.
Why a sister specifically? According to this approach there was no special need to posit a sibling relationship, but the guise would easily enable them to continue living together.
Lying and leading Egypt to sin – Though the commentators do not address the issue explicitly, they would likely say that lying is permissible in face of danger to one's life, even if it causes a stumbling block for another.
"לְמַעַן יִיטַב לִי בַעֲבוּרֵךְ" - asking for riches? While Abarbanel assumes that the good Avram is referring to is that his life be saved, Ralbag seems to suggest that he is referring to presents or honor that would be given to him by the Egyptians who desired Sarai. He does not address the issue of the insensitivity of such a deed.
Why punish Paroh?
Why does Avram repeat the actions in Gerar? Since preservation of life trumps all, it is not surprising that any time Avram was to find himself in a life-compromising situation, he would act similarly.
Avram Sinned
Avram's actions in descending to Egypt and endangering Sarai were problematic and Avram was punished for them.
Descent to Egypt – Ramban views Avram's decision to leave Israel as an expression of lack of faith in Hashem.36 He claims that Avram was in fact punished severely for his actions and the decree of slavery in Egypt was a direct outcome of this story.37 As evidence, he points to the many parallels38 between the two episodes,39 suggesting that the enslavement was a measure for measure punishment for Avram's deeds.
"וְחָיְתָה נַפְשִׁי" - Is Avram's life more important? Ramban and Cassuto fault Avram for trying to save himself at the expense of endangering Sarai, claiming that Avram should instead have trusted in Hashem to save them both.40
"הִנֵּה נָא יָדַעְתִּי..." – Ramban maintains that the word "נָא" refers to any fact which is a continuous truth41 pointing to its usage in Bereshit 16:2 and 19:8. The phrase does not connote that Avram first came to recognize Sarai's beauty upon entry into Egypt, but rather that he had known it all along.
"וְהָרְגוּ אֹתִי וְאֹתָךְ יְחַיּוּ"
Why a sister specifically? Ramban does not address this point. Cassuto maintains, like the Ran above, that Avram was hoping to pass as Sarai's guardian so as to negotiate her nuptials and thus push off potential suitors. In contrast to the Ran, though, he views this ruse as problematic, asserting that Avram should not have trusted in his own cleverness (which in the end failed him) but in Hashem.
Lying and leading Egypt to sin – Cassuto views this as Avram's main sin. He should have had faith in Hashem's salvation rather than resort to trickery and trust his own wiles to outwit the Egyptians. Cassuto asserts that in the end Avram's plan totally backfired. His fear that the Egyptians might take Sarai never materialized, and what he had not planned for, that Paroh might be interested, did occur. In the end, it was his lie itself that endangered Sarai; passing himself off as Sarai's brother is what enabled Paroh to take his wife.42
"לְמַעַן יִיטַב לִי בַעֲבוּרֵךְ" - asking for riches? Ramban minimizes the possible negative connotations of Avram's words by explaining that the good Avram is referring to relates to the provision of sustenance during the famine, not riches. In addition, in paraphrasing Avram's thoughts Ramban puts them into plural language, thereby having Avram include Sarai as a beneficiary of this "good."43 Cassuot instead suggests that all Avram's words are parallel to the end of the verse, "וְחָיְתָה נַפְשִׁי בִּגְלָלֵךְ" and that the good he speaks of refers to the saving of his life.
Why punish Paroh?
Why does Avram repeat the actions in Gerar? The Ran questions Ramban's criticism of Avram from this point, asking how it is possible that Avram would have repeated his sin by doing the same exact thing a few chapter later. In Ramban's Derashat Torat Hashem Temimah44 he suggests that Avram never knew for what he was being punished in the Covenant between the Pieces and so he repeated the error.