Lying

Is lying ever acceptable (for example, Exodus 1:17-19 and Joshua 2:4, which are neither condoned or condemned)?

You have observed correctly that the Bible includes some narratives without any commentary on the appropriateness or sinfulness of people’s actions.

Regarding Exodus 1:17-19, the king of Egypt issued a decree (of killing baby boys) that directly opposed God’s moral law that forbids murder. When children of God encounter conflicting commands from people and God, they side with God (Acts 5:29).

In the case of Joshua 2:4, children of God may sometimes wrestle with the possibility that their truthful statements will be used for harmful and ungodly purposes. While not necessarily commenting on Rahab’s particular course of action in Joshua 2:4, the inspired writer to the Hebrews provides this description of her interaction with the spies: “By faith the prostitute Rahab, because she welcomed the spies, was not killed with those who were disobedient” (Hebrews 11:31).

While Scripture alone is the source of our faith, explanations of our faith by fellow Christians can be helpful. So, in that way and within the context of your question, Martin Luther understood lying as withholding the truth from people who are entitled to it. We have to ask: was the king of Jericho entitled to the truth, since he was going to use the truth to oppose God’s plan and will? Christians might answer that question in different ways.

The People’s Bible Commentary for the book of Joshua lists (pages 35-36) some helpful truths to keep in mind regarding Rahab’s actions:

1) Her purpose and motive were in line with God’s revealed will.
2) All forms of deception are not necessarily immoral. (Cf. Exodus 1:17-19; 2:1-10)
3) The New Testament commends her faith and refers to her actions as fruits of faith. (Hebrews 11:31; James 2:25)
4) She was new to the faith and needed to determine a godly course of action quickly.
5) The cultural practices of her day meant looking out for guests.
6) We could always do something better with the benefit of hindsight. If our course of action is wrong, we rejoice that we have a Savior who was perfect in our place and has paid the debt of our sin and guilt.