The story of Rahab
Rahab lived on top of the double citywalls of Jericho. Not the safest of spots, especially now that the city was surrounded by Joshua’s troops. But Rahab was a whore and had very little choice.
Undoubtedly she felt betrayed by her fellow citizens. In any case, she was determined to join Joshua and his new beliefs. When he sent two spies into the city, she offered them shelter from the local powers and she let them escape over the wall. In exchange, they promised her protection during the battle; she had to tie a scarlet cord to her door, so that the soldiers would know which house to spare.
And so it happened, and Rahab escaped the total destruction of the city. Nobody knows precisely what became of her; in some stories she marries Joshua, according to others she became the wife of Prince Salmon.