In the genealogy of Matthew 1:2-16, the writer lists four women prior to Mary: Tamar (Matt 1:3), Rahab (1:5), Ruth (1:5), and the wife of Uriah (1:6).
There is no consensus among scholars as to what unites them. Do they each contribute something different to the genealogy? Is their association with sexual indecency the factor that brings them together for Matthew’s purpose(s)? Is their Gentile identity just as–if not more than–likely the common factor?
Since Matthew didn’t list prominent Jewish women, the inclusion of these four is most certainly not random. And if a common denominator exists among them, then Matthew isn’t so much emphasizing their different contributions as much as what they share in common. So what do they share?
Sexual indecency seems to be a strong contender. In Genesis 38, Tamar dressed like a harlot and seduced her father-in-law Judah. In Joshua 2, we discover Rahab had been a prostitute. In 2 Samuel 11, Bathsheba–“the wife of Uriah” (Matt 1:6)–commits adultery with King David. But what about Ruth? Some scholars imply premarital indecency between her and Boaz, but other scholars dispute this. Still, a strength of the “sexual indecency” common denominator is that the fifth woman (Mary) finds herself in a situation where others might charge her with sexual indecency (cf. Matt 1:18-19). But only three of the four OT women had clear instances of immorality in their past. Ruth’s case is, as I mentioned, disputed, and Mary did not commit any fornication with Joseph. Furthermore, Jewish tradition held the four women in higher regard, so their names wouldn’t have necessarily evoked sexual sin. As R. T. France observes in his NICNT commentary on Matthew’s Gospel, “In Jewish tradition Tamar, Rahab, and Ruth were regarded as heroines, and it is David rather than Bathsheba who is stigmatized for their adultery” (37). In the NT, for example, Rahab is an model of faith (cf. Heb 11:31; Jam 2:25).
The factor most likely uniting the four women is their Gentile background. Rahab and Tamar were Canaanites, Ruth was a Moabite, and Bathsheba was married to a Hittite. I think Ulrich Luz is right: “Matthew . . . was intent on ensuring that four Gentile women appeared in Jesus’ line of descent. In doing so he clearly sent a signal. The universalist perspective, the inclusion of the Gentile world, must have been important to him” (The Theology of the Gospel of Matthew, 26). Other features in Matthew’s Gospel support the emphasis on Gentile background. First, Matthew’s genealogy begins in 1:2 with Abraham (not Adam), who heard God’s agenda to bless all families of the earth through him (cf. Gen 12:2-3). Second, after Jesus is born, wise men (Gentiles!) search for the child and offer him treasures (cf. Matt 2:1-2, 10-11). Third, Matthew’s Gospel ends with a Great Commission to make disciples of all nations (Matt 28:19-20). These are a few examples that show Matthew highlighting Gentile inclusion in God’s mission through Jesus.
In summary, Matthew included four OT women in his genealogy. He didn’t include names like Sarah or Rebekah. He included ladies who had some unsavory episodes in their past, but the reason for their inclusion lay elsewhere. These women–Ruth, Rahab, Tamar, and Bathsheba–were heroines. What united them was most likely their Gentile background, an emphasis important to Matthew’s Gospel and evident in its opening chapter.