You teach that the Canaanites were cursed and therefore the Lord intended to wipe out the entire lineage. Since Rahab was a Canaanite, how did the Lord allow her to be a part of Christ's line?
The curse against the Canaanites fell upon the people who descended from Canaan, as Noah declared:
Gen. 9:25 So he said,
“Cursed be Canaan;
A servant of servants
He shall be to his brothers.”
Gen. 9:26 He also said,
“Blessed be the Lord,
The God of Shem;
And let Canaan be his servant.
Gen. 9:27 “May God enlarge Japheth,
And let him dwell in the tents of Shem;
And let Canaan be his servant.”
The curse fell upon the son of Ham, Canaan, and all the people who descended from Canaan. The purpose of the curse was to open the land for Israel’s eventual occupation, as God promised to Abraham:
Gen. 15:12 Now when the sun was going down, a deep sleep fell upon Abram; and behold, terror and great darkness fell upon him.
Gen. 15:13 God said to Abram, “Know for certain that your descendants will be strangers in a land that is not theirs, where they will be enslaved and oppressed four hundred years.
Gen. 15:14 “But I will also judge the nation whom they will serve, and afterward they will come out with many possessions.
Gen. 15:15 “As for you, you shall go to your fathers in peace; you will be buried at a good old age.
Gen. 15:16 “Then in the fourth generation they will return here, for the iniquity of the Amorite is not yet complete.”
In v.16 the name “Amorite” is a synonym for the Canaanite people in general. God declares that the timing for Abraham’s descendants to enter the land was tied to the curse upon Canaan (i.e., the Amorites). Therefore, we know the curse served a good purpose in God's plan by giving just cause for assigning the land to Israel. Nevertheless, for 400 years after the promise was spoken to Abraham, the Canaanites were permitted to occupy the land so that the land might be prepared for Israel’s arrival one day. In a sense, the Lord made the Canaanites caretakers for Israel’s eventual takeover.
Once Israel entered the land, the people of God were supposed to remove the Canaanites entirely in keeping with God's curse, Instead, the Jewish people tired of war and conceded territory to the Canaanites. After that, Israel had many occasions to interact with these doomed caretakers. God expressly prohibited His people from intermarriage with the Canaanites due to their harmful influence and the curse:
Deut. 7:1 “When the Lord your God brings you into the land where you are entering to possess it, and clears away many nations before you, the Hittites and the Girgashites and the Amorites and the Canaanites and the Perizzites and the Hivites and the Jebusites, seven nations greater and stronger than you,
Deut. 7:2 and when the Lord your God delivers them before you and you defeat them, then you shall utterly destroy them. You shall make no covenant with them and show no favor to them.
Deut. 7:3 “Furthermore, you shall not intermarry with them; you shall not give your daughters to their sons, nor shall you take their daughters for your sons.
Deut. 7:4 “For they will turn your sons away from following Me to serve other gods; then the anger of the Lord will be kindled against you and He will quickly destroy you.
Deut. 7:5 “But thus you shall do to them: you shall tear down their altars, and smash their sacred pillars, and hew down their Asherim, and burn their graven images with fire.
Deut. 7:6 “For you are a holy people to the Lord your God; the Lord your God has chosen you to be a people for His own possession out of all the peoples who are on the face of the earth.
The Lord was concerned for Israel’s identity. His nation could not mix with the cursed Canaanite peoples lest they lose their identity and turn away from the Living God. Regrettably, Israel disobeyed this command many times over the centuries, yet the Lord remained faithful. At times, He took steps to ensure the people were protected from their own sin, including disciplining the nation harshly when they strayed into idolatry.
When Judah strayed and married a Canaanite bride, Shua, their sons were barred from carrying the seed promise of God because they were under the Canaanite curse. Therefore, the Lord put them to death and brought forth children through Judah and his Jewish daughter-in-law, Tamar. On the other hand, God permitted Salmon to marry Rahab, a Canaanite woman, and produce children in the line of Christ. So what’s the difference between Rahab and Shua?
In a word, faith. While the sons of Shua are clearly shown to be evil unbelieving men in Genesis 38, the Bible says Rahab was a woman of faith (Heb 11:31). By faith, God redeems those under the curse, as Paul says:
Gal. 3:11 Now that no one is justified by the Law before God is evident; for, “the righteous man shall live by faith.”
Gal. 3:12 However, the Law is not of faith; on the contrary, “He who practices them shall live by them.”
Gal. 3:13 Christ redeemed us from the curse of the Law, having become a curse for us — for it is written, “Cursed is everyone who hangs on a tree” —
Gal. 3:14 in order that in Christ Jesus the blessing of Abraham might come to the Gentiles, so that we would receive the promise of the Spirit through faith.
Christ took our curse when He was killed on a “tree” as Paul says. So by her faith in Messiah, Rahab was redeemed from the curse of the Canaanites and the curse of sin. Such redemption was rare in the history of Israel, since apart from the few who knew faith, the Canaanite people were devoted to destruction so that God’s people might receive their inheritance in the land.