Joshua instructed the two spies to bring Rahab and all who belonged to her out of the house, as they had sworn to her Joshua 6:22–23. The account says she lived in Israel because she hid the messengers Joshua sent to spy out Jericho Joshua 6:25.
In Joshua 6:22–25, Joshua orders the two former spies to rescue Rahab and everyone connected to her, keeping the oath they had made. The spies bring Rahab and her family out and place them outside Israel’s camp. Jericho is then burned, while precious metals are separated out and placed into the treasury associated with Yahweh’s house. These verses sit inside the Jericho account, immediately after the city’s collapse and the stated plan for what must happen to people and goods in the city (Joshua 6:17–21).
These verses show follow-through on a promise. Joshua orders the same two spies from earlier to bring Rahab out of Jericho, explicitly “as you swore to her” (explicit textual claim). The rescue is narrated as careful and extensive: Rahab, her parents, brothers, and wider relatives are brought out (explicit textual claim).
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 6:22-23, then read the surrounding section so the answer stays connected to the passage's flow.
22Joshua said to the two men who had spied out the land, Go into the prostitute`s house, and bring out there the woman, and all that she has, as you swore to her.
23The young men the spies went in, and brought out Rahab, and her father, and her mother, and her brothers, and all that she had; all her relatives also they brought out; and they set them outside of the camp of Israel.