The story of Tamar is not out of place here. This incident follows chronologically the sale of Joseph in Egypt (Genesis 38:1), and it is consistent with the fact that Judah has just left his brothers, which points to his disagreement with them. In addition, the text shares a number of common words and motifs with the preceding chapter, and it carries the same theological lesson: an evil act that will be turned into a positive event linked to salvation.
Read Genesis 38:1-30. Compare Judah’s behavior with that of the Canaanite Tamar. Who of the two is the more righteous, and why?
Judah finds a Canaanite wife (Genesis 38:2) with whom he has three sons: Er, Onan, and Shelah. Judah gives the Canaanite Tamar as wife to Er, his firstborn, in order to ensure proper genealogy. When Er and Onan are killed by God because of their wickedness, Judah promises his last son, Shelah, to Tamar.
When, after some time, Judah seems to have forgotten his promise, as he goes to comfort himself after the death of his wife, Tamar decides to play the prostitute in order to force him to fulfill his promise. Because Judah has no cash to pay the prostitute, whom he does not recognize, he promises to send her later a goat from his flock.
Tamar, meanwhile, requires that he give her, in the meantime, as an immediate guarantee of payment, his signet and cord and his staff. Tamar will get pregnant from this unique encounter. When later, accused of playing the harlot, she will show to the accuser Judah his signet and cord and his staff. Judah understands and apologizes.
The conclusion of this sordid story is the birth of Perez, meaning “breaking through,” who, like Jacob, was born second, and became first, and was named in salvation history as the ancestor of David (Ruth 4:18-22), and ultimately of Jesus Christ (Matthew 1:3). As for Tamar, she is the first of the four women, followed by Rahab (Matthew 1:5-6), Ruth (, Matthew 1:6), and the wife of Uriah (Matthew 1:6) who genealogically preceded Mary, the mother of Jesus (Matthew 1:16).
One lesson we can take from this story: just as God saved Tamar through His grace, transforming evil into good, so will He save His people through the cross of Jesus. And in the case of Joseph, He will turn the troubles of Joseph into the salvation of Jacob and his sons.