She provided hospitality to the two men whom Joshua sent to spy upon the city as recorded in the Bible in the book of Joshua, in exchange for her and her family to be spared when the Hebrews took the city when the walls fell down. The spies agreed provided that she follow three conditions (all of which she did):
- She place a scarlet thread outside her window (so the army would know her house from the others)
- She and her family remain inside the house during the battle (as the army would not know her or her family from the others)
- She not give up the spies to the king
"And the king of Jericho sent unto Rahab, saying, Bring forth the men that are come to thee, which are entered into thine house: for they be come to search out all the country. And the woman took the two men, and hid them, and said thus, There came men unto me, but I wist not whence they [were]: And it came to pass [about the time] of shutting of the gate, when it was dark, that the men went out: whither the men went I wot not: pursue after them quickly; for ye shall overtake them. But she had brought them up to the roof of the house, and hid them with the stalks of flax, which she had laid in order upon the roof." (Joshua 2:3-6)
"But Joshua had said to the two men who had spied out the country, 'Go into the harlot's house, and from there bring out the woman and all that she has, as you swore to her'" (Joshua 6:22)
She is mentioned with reverence in the New Testament as well.
"By faith the harlot Rahab did not perish with those who did not believe, when she had received the spies with peace" (Hebrews 11:31).
"Likewise, was not Rahab the harlot also justified by works when she received the messengers and sent them out another way?" (James 2:25).