Joshua sent two men to spy out the land, especially Jericho Joshua 2:1. Their mission was reconnaissance before Israel’s advance across the Jordan into Canaan Joshua 2:1.
Joshua secretly sends two spies from Shittim to inspect Jericho. They lodge in Rahab’s house, but the king quickly hears that Israelite men have entered the city to scout it. The king orders Rahab to hand them over. Rahab hides the men instead and tells the king’s messengers the visitors have already left near nightfall. This episode comes right after Joshua’s commissioning and the people’s preparation to cross the Jordan, as Israel moves from wilderness travel into taking the land (Joshua 1:1–18).
Joshua 2:1–7 presents a tense, fast-moving sequence: Joshua sends two spies secretly; they end up staying at Rahab’s house; Jericho’s king quickly hears about their presence; the king orders Rahab to produce them; Rahab hides them and gives a story that sends the search in the wrong direction; the pursuers head toward the Jordan crossings; and the city gate.
A careful answer keeps the immediate passage, the book's argument, and the whole-Bible storyline together, so the question is answered in context instead of as a detached idea.
Start with Joshua 2:1, then read the surrounding section so the answer stays connected to the passage's flow.
1Joshua the son of Nun sent out of Shittim two men as spies secretly, saying, Go, view the land, and Jericho. They went and came into the house of a prostitute whose name was Rahab, and lay there.