Mark Goodacre has begun a brief but informative podcast dealing with aspects of New Testament studies. His first podcast deals with the presence of the 4 women in Matthew's genealogy. You can listen to the podcast by clicking here. Craig Blomberg notes that these women may have been included "as examples of sinners Jesus came to save, representative Gentiles to whom the Christian mission would be extended, or women who had illicit marriages and/or illegitimate children. The only factor that clearly applies to all four is that suspicions of illegitimacy surrounded their sexual activity and childbearing" (1992: 55-56). Craig Keener sees the gentile connection and notes that "Sarah, Rebekah, Leah, and Rachel" would have been expected if Israelite matriarchy was in view (1999: 78). Ben Witherington notes Tamar, Rahab, Ruth, and Bathsheba are mentioned "to emphasize 'divine irregularity'...[to] provide precedents by which the Evangelist can defend within an honor and shame culture what God did in regard to Mary" (2006: 41). While these are all possible, the context of first century Roman imperialism might provide insight into the role of these women in the genealogy. Warren Carter contends that "the Gospel's hearers are to supply information from the biblical tradition to expand cryptic textual references and to elaborate names" (2001: 98). Each of these women are seen in the context of imperialism and it may be Matthew's way of indicating that God's purposes will be accomplished in spite of imperial claims and domination. So, Matthew's inclusion of these women in the genealogy might function as an identity forming discourse within the Jesus-movement in order to indicate that despite conquest and domination God's plan will be fulfilled. So, someone might be interested in tracking down the imperial context of each of these four women and relate that to Mary's experience with Roman Imperialism and see if this suggestion holds up.
References:Blomberg, Craig. Matthew. The New American commentary, v. 22. Nashville, Tenn: Broadman Press, 1992.
Carter, Warren. Matthew and Empire: Initial Explorations. Harrisburg, PA: Trinity Press International, 2001.
Keener, Craig S. A Commentary on the Gospel of Matthew. Grand Rapids, Mich: W.B. Eerdmans Pub, 1999.
Witherington, Ben. Matthew. Smyth & Helwys Bible commentary. Macon, Ga: Smyth & Helwys Pub, 2006.