There are some believers who might think that God approved of Rahab in lying; However, Rahab did not break the 9th Commandment and lie. She was using the art of war in protecting the interests of God's people. For she did not lie to protect herself or to cover up another sin or anything of that nature.
For in war time or in protecting your loved ones or God's people, a person can use the art of war to defend that which is good. This sometimes unfortunately involves deceiving and or eliminating your enemy; However, these things are not done out of selfish ambition, but they are done in order to preserve innocent lives or to protect the common good.
For the Hebrew midwives had lied to the Pharoah's servants to protect the innocent (
Exodus 1).
And King David pretended he was crazy when he was not crazy in front of the enemy king of Gath named "Achish" (
1 Samuel 21:10-15).
Also, Elisha deceived the enemy when they were blinded by lying about where he was taking them. (
2 Kings 6:19)
In addition in
Joshua 8:
Joshua himself went in battle against the city of Ai, they pretended that they were being defeated and they retreated. They weren’t being defeated—it was a trap. The Israelites deceived them.
Please take note that God told Joshua to lay an ambush for the army at Ai. If you were to read the chapter, this ambush involved deception. In other words, God was telling Joshua to deceive their enemies as a part of the art of war.
However, if a certain spirit was telling Joshua to lie so as to cover up a sin and or his own embarrassment or shame about something, then that would be a wrong spirit who was trying to make Joshua break the 9th Commandment.
Think of it this way. When a person selfishly takes their own life, it is considered suicide.
But when a person throws themselves in harm's way so as to save a life like a father pushing his son out of the way of a moving car (with him being hit), it is considered great love. This is what Jesus has done for us. He has died in our place so as to give us eternal life and salvation so as to spend eternity with Him and His good ways.
Side Note:
Oh, and one more thing. I would like to add that believers today are not under the Old Covenant anymore. God is not telling His people to go to war with certain nations, and use deception as a part of the art of war, etc. Believers today are under the New Covenant with a different set of laws or commands that involves love and non violence. There is no command in the New Testament that gives believers today a loophole for lying to people. If a believer is in a difficult situation whereby they are forced to lie so as to protect a loved one today, I believe that they will repent of such a sin (i.e. confess it to the Lord Jesus Christ). For how often does a person run into this kind of scenario? If they repeatedly do so, then they need to stand up for what is good and right and trust in God's good ways. It is still always wrong to lie out of our own selfish motives and ambitions. There was a time and place for such things in the past, but we believers today are called to be imitators of Jesus Christ. We follow a higher calling of love and goodness. For do you think Jesus would lie to protect life? Maybe a play on words, but not a bold face lie.
For example: If I was hiding Jews during the time of the war, and Germans broke into my house, and they asked me, "Are there any Jews here?"
Instead of freezing up like a deer in headlights thinking about a "yes" or a "no", I could reply,
"Do you see any Jews around here?" "Please feel free to look around."
...