A record of the genealogy of Jesus Christ the son of David, the son of Abraham: Abraham was the father of Isaac, Isaac the father of Jacob, Jacob the father of Judah and his brothers, … Salmon the father of Boaz, whose mother was Rahab, Boaz the father of Obed, … Jesse the father of King David (Mat 1:1-5).

Genealogies in the Bible are not given simply to show who the ancestors of the Jews were, but to show how the inheritance originated from God had been given to certain individuals, and then, handed down to a certain group of their descendants, and so on. In other words, the significance of genealogies lies in the passing of God's inheritance in the history of humankind. The reason that the above genealogy in Matthew begins with Abraham is that the original inheritance given to Adam at the creation was lost as a result of sin, but came to be renewed at the time of Abraham with the covenant God made with him promising that a nation of God's heirs would be built, and eventually the other peoples on earth would join them as well. As you know, this promise has come to be fulfilled in Christ: the Gentiles can be heirs of God by faith. And as if to show and prove this truth, Matthew lists the name Rahab in the genealogy above. She was a Canaanite woman, a prostitute.

Then Joshua son of Nun secretly sent two spies from Shittim. "Go, look over the land," he said, "especially Jericho." So they went and entered the house of a prostitute named Rahab and stayed there (Josh 2:1).

The Israel army marched around Jericho with the ark of the covenant carried by priests. Following the long blast of the seven shofaroth, the army shouted a big war cry, and at that time, the walls of Jericho fell down flat where they were. The city and everything in it was totally devoted to God, and Joshua pronounced a curse upon it saying:

Cursed before the LORD is the man who undertakes to rebuild this city, Jericho: At the cost of his firstborn son will he lay its foundations; at the cost of his youngest will he set up its gates (6:26).

Rahab, a prostitute, who was living in such a city, was saved from this curse and chosen as an heir of God, and out of her descendants came Jesus Christ.

Then they burned the whole city and everything in it, … But Joshua spared Rahab the prostitute, with her family and all who belonged to her, because she hid the men Joshua had sent as spies to Jericho—and she lives among the Israelites to this day (vv. 24-25).

The statement, "she lives among the Israelites to this day," indicates that she was accepted as an Israelite woman. In fact, according to the genealogy in Matthew, she married Salmon, who was from the tribe of Judah, and bore a son, Boaz, who also married a Gentile woman, Ruth. At the time of the writing of the book of Joshua, she was still alive, and probably lived in Bethlehem. Note how she confessed to the two spies about the God of Israel:

I know that the LORD has given this land to you … We have heard how the LORD dried up the water of the Red Sea for you when you came out of Egypt, … for the LORD your God is God in heaven above and on the earth below (2:9-11).

It was because of this faith and the confession she made that she, her family, and all who belonged to her were saved from the destruction of Jericho, and counted among the chosen people, the heirs of God.