Joshua 2:22
And they went, and came unto the mountain, and abode there three days, until the pursuers were returned: and the pursuers sought them throughout all the way, but found them not. And they went, and came unto the mountain, and abode there three days, until the pursuers were returned: and the pursuers sought them throughout all the way, but found them not.
The opening chapters of Joshua, in Joshua 1 and 2, show that God had placed the spirit of Moses upon Joshua as his successor. Joshua sent two spies to view the land and report back to him, and they lodged at Rahab's house in Jericho. When the king demanded them, Rahab concealed them, and God delivered them from pursuers who searched throughout all the way without finding them. They therefore finished viewing the country and reported back when their tour was completed.
The account identifies Rahab as a harlot, and she stands in the ancestry of Jesus before Mary alongside Thamar who acted the part of a harlot with her father-in-law, Ruth a Moabitess descended from the daughter of Lot by her own father, and Bathsheba the wife of Uriah whose course with David has been a reproach for thousands of years. Rahab was saved not because she helped the spies escape, but because she trusted that Israel's God was the true God. The naming of such women instead of only good and exemplary women is God's way of presenting hope to the fallen, that even if the worst inherited tendencies and appetites have been received there is hope. Christ was conceived in that fallen humanity to share its sorrows and temptations and give the example of a sinless life.
When workers go in the name of the Lord to do His work He protects them so they can finish it and blesses both them and those they visit. The spies received a blessing in doing their work, and Rahab and her whole household were saved and blessed by their coming.