“Then Joshua son of Nun sent two men secretly from Shittim as spies. He said to them. ‘Go! View the land, especially Jericho.’ So they went. They entered the house of a prostitute whose name was Rahab. They spent the night there. The King of Jericho was told. ‘Some Israelites have come here tonight to search out the land.’ Then the King of Jericho sent orders to Rahab. ‘Bring out the men who have come to you, who entered your house. They have come only to search out the whole land.’ But the woman took the two men and hid them. Then she said. ‘True, men came to me. But I did not know where they came from. When it was time to close the gate at dark, the men went out. Where the men went I do not know. Pursue them quickly, for you can overtake them.’”
The Israelites were camped at Shittim, while Jericho was in the Jordan valley. Joshua sent spies out to view the land. They visited a prostitute. There is no indication why they went there. Anyhow, the King of Jericho found out about them. He asked Rahab what happened. She said that they were there but had left. She suggested that they go catch them when, in fact, she had hid them. Rahab, the prostitute, gave the leaders of Jericho the wrong information.
“She had, however, brought them up to the roof. She had hidden them with the stalks of flax that she had laid in order out on the roof. So the men pursued them on the way to the Jordan as far as the fords. As soon as the pursuers had gone out, the gate was shut.”
Rahab had hid them on the roof. While the others were pursuing the two spies, the gate of the town was shut. So far, all is going well.