Joshua chose two men as spies and sent them from their camp saying, “Go across the river and find out as much as you can about the whole region, especially about the town of Jericho.”
The two spies left the Israelite camp and went to Jericho, where they decided to spend the night at the house of a prostitute named Rahab.
But someone found out about them and told the king of Jericho, “Some Israelite men came here tonight, and they are spies.” So the king sent soldiers to Rahab’s house to arrest the spies. But, Rahab hid the men on the roof of her house so when the soldiers came to her door and demanded, “Let us have the men who are staying at your house. They are spies.”
She answered, “Some men did come to my house, but I didn’t know where they had come from. They left about sunset, just before it was time to close the town gate. I don’t know where they were going, but if you hurry, maybe you can catch them.” The soldiers headed out to look for the spies at the place where people cross the river.
Rahab went back up to her roof and she told them:
I know that the Lord has given Israel this land. Everyone shakes with fear because of you. We heard how the Lord dried up the Red Sea so you could leave Egypt. And we heard how you destroyed Sihon and Og, those two Amorite kings east of the Jordan River. We know that the Lord your God rules heaven and earth, and we’ve lost our courage and our will to fight.
Please promise me in the Lord’s name that you will be as kind to my family as I have been to you. Do something to show that you won’t let your people kill my father and mother and my brothers and sisters and their families.
“Rahab,” the spies answered, “if you keep quiet about what we’re doing, we promise to be kind to you when the Lord gives us this land. You must tie this red rope on your window when we attack, and your father and mother, your brothers, and everyone else in your family must be here with you. We’ll take the blame if anyone who stays in this house gets hurt. But anyone who leaves your house will be killed, and it won’t be our fault.
“I’ll do exactly what you said,” Rahab promised. Then she sent them on their way and tied the red rope to the window.
The spies hid in the hills for three days while the king’s soldiers looked for them along the roads. As soon as the soldiers gave up and returned to Jericho, the two spies went down into the Jordan valley and crossed the river. They reported to Joshua and told him everything that had happened.
Fastforward to the end of chapter 6…After the 7 priests carrying the 7 trumpets for 7 days and marched around the city seven times and Joshua had the people shout and the trumpets shout and the walls of Jericho came down….
Joshua said to the two men who had spied out the land, “Go into the Rahab’s house, and bring the woman out of it and all who belong to her, as you swore to her.” So the young men who had been spies went in and brought Rahab out, along with all her family —and set them outside the camp of Israel. They burned down the city, and everything in it; only the silver and gold, and the vessels of bronze and iron, they put into the treasury of the house of the Lord. But Rahab, with her family and all who belonged to her, Joshua spared. Her family has lived in Israel ever since. For she hid the messengers whom Joshua sent to spy out Jericho.