It is not uncommon for people to bring up the story of the Hebrew midwives when the topic of lying is raised. It usually arises when someone asked whether it is ever justifiable to lie. A common version of this question concerns the Nazis. If you knew where Jews were hiding back during WWII and Nazis showed up at your door asking whether you knew where any Jews were hiding would it be justifiable to lie to them? Then the example of the Hebrew midwives comes up as an example of God praising lies.
Did God praise them for lying? I think several things need to be taken into consideration when we look at this text.
Scripture gives us reason to believe that in war, certain actions take on a different moral character - a different definition, as it were. One of the ten commandments, for example, is “Thou shalt not kill.” That seems clear enough, right? But when Israel enters into war with an enemy, God has certain rules - and killing enemy soldiers is one of them. Now unless God contradicts Himself, which He cannot do, we have to conclude that under certain circumstances (e.g. just war, capital punishment), killing another human being is justified. The killing of enemy soldiers in a just war is not necessarily murder, and it doesn't violate the commandment against murder. We know that God also condemns lying because He is a God of truth and He hates lies. But in a context of war, deception of the enemy is justified just as killing of the enemy is justified. Israelite commanders, for example, are not required to tell the enemy commanders where all of their troops are located, what their numbers are, the kind of weapons they have, their battle strategy, etc. Narratives of battles in Scripture that God approves describe deceptive tactics. The army, for example, may pretend to be in retreat and then send a hidden force of soldiers to burn the enemy city once the troops in that city start chasing them. Deception of the enemy is necessary in the context of just war. So, again, unless God contradicts Himself (and He cannot do that), deception of the enemy in war is not lying any more than killing of enemy soldiers in war is murder. That brings us to the Hebrew midwives (and Rahab as well for that matter). If deception of the enemy in wartime contexts is justified, and if Pharaoh has effectively declared war against YHWH and His people Israel, then the actions of the midwives is justifiable because they are done in the context of a war – a context in which all kinds of actions are done that are not justifiable in normal circumstances. This also helps explain the approval of Rahab’s actions in Jericho – since it was in the context of the war against the Canaanites. I think the common Nazi example that arises in these discussions is understandable in this way too. The extermination of Jewish civilians by the Nazi government was an ongoing war crime. Citizens of every occupied nation in that war had every justification for deceiving the Nazis and protecting innocent human beings from being murdered. They would be doing what Rahab did. Killing another human being is murder under normal circumstances. Killing an enemy soldier in war is not murder. Similarly deceiving another human being is lying under normal circumstances. Deceiving the enemy in war is not. This isn't situation ethics which would say that in some situations murder is okay and in some situations lying is okay. Things like capital punishment and killing of enemy soldiers in war are not murder. And deceiving the enemy in war is not lying. The moral character of the action changes in the context of war.
Consider a football game. Let’s say you are the quarterback in a football game. You take the snap and fake a handoff to the running back who then runs to the right sideline. The defense goes after him. You then throw the ball you’ve been hiding to an open receiver running to the left. He is wide open and scores a touchdown. Do the fans and the defense start jumping up and down accusing you of lying because you faked a handoff? No. A fake handoff in that context isn't lying, and everyone realizes that. Deceiving the enemy in war is a "fake handoff."