Now, back in Numbers 13, God instructs Moses to select one person from each tribe to search out the land. That's why Moses sends 12 spies. Ten of those spies returned and talked about the land flowing with milk and honey; but, that the inhabitants were like giants. They voted to not go into Canaan. It's no wonder that Joshua decided to go with only two spies. Because of the ten doubters the chosen people had been restrained from entering Canaan until they all died out except Joshua and Caleb and the little ones. (Numbers 14:30-31) That took forty years. Joshua had no desire to spend another forty years in the desert.
All of Jericho and the surrounding area (Canaan) know the stories surrounding the Israelites. They know about the exit from Egypt, the Red Sea parting, the wandering in the wilderness and the victory over the Amorites. They also know that the Israelites' God has promised them Canaan. So, when Joshua sends the two spies, the word goes out that they are coming. They're at Rahab's place and the king wants them brought to him. Rahab knows the stories too. She tells her lodgers that the entire country is faint with fear over their coming. These were the same folks who were called "giants" by those ten spies forty years ago. Times have changed.
Rahab hides the spies. Then, she reports to the king's men that, indeed, they have been there. But, they left the city right at dusk. If they hurry, they might catch them. At dusk, the sun is low enough that it makes it hard and almost impossible to see well. What a clever ploy! She was buying time for her two lodgers. This woman made a conscious decision to help God's people. What a transformation! Jericho is a wicked city that worships the goddess of the moon, Ashtaroth. They're Gentiles and they practice one of the most vile and degrading religions of that region.
Rahab was smart enough to know that God was going to have His way. It had been forty years and here they were again. She knew she needed to make a decision--go with the goddess Ashtaroth or God. For whatever her reasons were, she knew. She also knew that she wanted to be saved and her household with her. She opted to save the spies and plead for their help.
Rahab's house, because of her occupation, was part of the outside wall of Jericho. God thinks of everything, doesn't He? Rahab, part of the plan of God, lowers the men to safety by a scarlet cord. The men tell her to hang the same cord from her house and it will be spared. Judgment is coming to Jericho and she knows it. The two men tell her that on that day she is to stay in the house and not to leave it. As long as she stays in God's plan, she and those with her are safe. If she leaves, her safety goes with it. Stay in God's plan and He will stay with you.