Rahab's dwelling place was part of Jericho's city wall. Joshua 6:
On the day of the attack, Joshua 6:15 Then she let them down by a rope through the window, for her house was built into the city wall, so that she lived in the wall.
Joshua's soldiers were gathered at one spot. The wall at that spot collapsed, not the entire city wall. There was no strategic need for the entire circling wall to collapse.20 When the trumpets sounded, the army shouted, and at the sound of the trumpet, when the men gave a loud shout, the wall collapsed;
Rahab's house did not collapse.so everyone charged straight in, and they took the city. 21They devoted the city to the Lord and destroyed with the sword every living thing in it—men and women, young and old, cattle, sheep and donkeys.
22 Joshua said to the two men who had spied out the land, “Go into the prostitute’s house
Which part of the wall collapsed?and bring her out and all who belong to her, in accordance with your oath to her.” 23So the young men who had done the spying went in and brought out Rahab, her father and mother, her brothers and sisters and all who belonged to her. They brought out her entire family and put them in a place outside the camp of Israel. 24a And they burned the city with fire, and everything in it.
The main gate with its wall collapsed.26Joshua laid an oath on them at that time, saying, “Cursed before the LORD be the man who rises up and rebuilds this city, Jericho.
“At the cost of his firstborn shall he lay its foundation, and at the cost of his youngest son shall he set up its gates.”