The pairing with Parashah Shelach, whose central episode is Moses sending twelve spies to scout the land of Canaan, ten of whom return with a discouraging report that turns the people against entering the land at all, rests on the shared premise of both accounts, a scouting mission sent ahead of an invasion, while sharply contrasting how each mission actually turns out.
Where the twelve spies in the parashah see the same land and reach two opposite conclusions, most seeing insurmountable giants and fortified cities while only Caleb and Joshua urge confidence, the two spies in the haftarah, sent by that same Joshua now grown into Israel's leader, find unanimous and immediate confirmation that the land's inhabitants are already terrified, a confidence the earlier generation's spies had refused to credit even when the same underlying reality, God's power on Israel's behalf, had not changed at all.
The haftarah's Rahab, who recognizes God's hand in Israel's coming victory before that victory has even occurred, stands in deliberate contrast to the parashah's own faithless spies, an outsider grasping immediately what an entire generation of Israelites had refused to trust, a reversal the tradition reads as central to why this specific haftarah was chosen to accompany the story of the earlier mission's failure.