I have always maintained that the Bible is not a book that anyone would think to sit down and write. There are too many twists and surprises which give it a stamp of authenticity. So it is with the ironic tale of Rahab, the heroine prostitute!
Reading in between the lines of Joshua 2 gives us insight as to some of the interesting action going on behind the scenes. Joshua - who himself had been one of the 12 spies sent into Canaan a generation earlier - slips two of his men into the Promised Land to have a look-see, especially the city of Jericho. He must think the business of spying out the land is still a good way to go, but this time limits the field to only a couple of men.
Jericho, just due north of the Dead Sea, sits right across the Jordan River from where Joshua and the children of Israel are encamped. It will be the first goal that the invading Israel army sets its sights upon - a kind of Normandy on D-Day.
Now, I don't know how it could have possibly happened, but these two young men spying out the land somehow ended up at a house of prostitution in Jericho! (Maybe there were given bad directions?) Anyway, however it went down, the spies' presence was detected in the city, and the king of Jericho dispatches his troops to Rahab's to arrest them.
Thinking quickly, she comes up with a story. She admits that, yes, the men had indeed been there, but she feigns ignorance as to their identity and then outright lies, telling the king's men that the spies had already fled the city. The soldiers take off after them in a wild good chase, pursuing men who had never even left her dwelling. Rahab had instead hidden them on her roof under stalks of flax.
Why does Rahab betray her own people and help these two strangers who threaten her community? Because she and the rest of the city are petrified of Israel's God! "I know that the Lord has given you the land, and that dread of you has fallen on us, and that all the inhabitants of the land melt in fear before you" (vs. 9). Rahab had heard the story of Israel's deliverance through the Red Sea and knew of their military victories en route to their Promised Land. "As soon as we heard it, our hearts melted, and there was no courage left in any of us because of you. The Lord your God is indeed God in heaven above and on earth below" (vs. 11)
Rahab is so terrified of the impending destruction she senses is looming over the city that she strikes a deal with the spies: I'll protect you now if you promise to protect me and my family when you take over. The spies agree, set up a signal involving a scarlet cord and eventually make their way back across the Jordan to the Israelites' camp.
Joshua 2 is a good example of what happens when your reputation precedes you. The fear of God was already winning the war among the Canaanite people! The fight was not in them. The spies rejoice to report all this news back to Joshua (vs. 24).