These words were spoken to Rahab by Joshua's spies after she had protected them from discovery by the officials of Jericho. She had testified to the spies that "the Lord your God, he is God in heaven above, and in earth beneath" (Joshua 2:11). Therefore, "by faith the harlot Rahab perished not with them that believed not, when she had received the spies with peace" (Hebrews 11:31).
Rahab's spiritual salvation came because of her faith in the true God; she soon entered into the covenant family of Israel and eventually even became a member of the family line leading to Jesus Christ (Matthew 1:5). Her physical deliverance, on the other hand, and that of her family depended on a "line of scarlet thread" suspended from her window, identifying her home as "under the blood," so to speak, when Jericho fell and all its other inhabitants perished.
This thin, blood-red line constituted a very slender hope for Rahab in the midst of such a scene of judgment and total destruction, but it sufficed. It is fascinating to note that the Hebrew word for "line" (occurring here for the first time in the Bible) is everywhere else translated by the key word "hope." Perhaps "line" soon came to mean "hope" because of this very experience, when a "scarlet hope" extended all the way from a repentant sinner to the very God of heaven! Note the same thought with the same word: "For thou art my hope, O Lord God" (Psalm 71:5).
"And every man that hath this hope in him purifieth himself, even as he is pure" (1 John 3:3). HMM