John Calvin's Bible Commentary
Joshua 6:22
22.But Joshua had said unto the two men, etc The good faith of Joshua in keeping promises, and his general integrity, are apparent in the anxious care here taken. But as the whole city had been placed under anathema, a question might be raised as to this exception of one family. No mortal man was at liberty to make any change on the decision of God. Still as it was only by the suggestion of the Spirit that Rahab had bargained for her impunity, I conclude that Joshua, in preserving her, did only what was considerate and prudent.
We may add, that the messengers were not yet under any contrary obligation, as the complete destruction of the city had not been declared. It is true, they had heard in general, that all those nations were to be destroyed, but they were still at liberty to make a compact with a single woman, who had voluntarily abandoned her countrymen. But we shall afterwards meet with a far easier solution, namely, that while the Israelites, by the divine command, exhorted all whom they attacked, to surrender, by holding out the hope of pardon, the blinded nations obstinately refused the peace thus offered, because God had decreed to destroy all of them. But while all, in general, were hardened to their destruction, it follows that Rahab was exempted by special privilege, and might escape in safety, while the others perished. Joshua, therefore, judged wisely, that a woman who had voluntarily gone over to the Church, was rescued thus early, not without the special grace of God. The case of the father and the whole family is, indeed, different, but seeing they all spontaneously abjure their former state, they confirm the stipulation which Rahab had made for their safety, by the promptitude of their obedience.
Moreover, let us learn from the example of Joshua, that we do not sufficiently attest our probity, by refraining from violating our promise intentionally and of set purpose, unless we also diligently exert ourselves to secure its performance. He not only allows Rahab to be delivered by her guests, but is careful to guard against her sustaining any injury in the first tumult; and to make the messengers more diligent in performing their office, he reminds them that they had promised with the intervention of an oath.