There are some really uncomfortable truths to understand in the account of Judah and Tamar, and the birth of Perez and Zerah. God’s Word tells us that two of Judah's sons are struck down by God because of their wickedness.
In the first case, we don't know exactly what Er did that was wicked, but considering it is the first such recorded judgment other than Sodom and Gomorrah, it must have been significant. In the case of his brother, Onan, the judgment is because he refused to fulfill an obligation to provide sons to carry on his dead brother's name. For us today, it's hard to understand because the custom of a brother sleeping with his sister-in-law after her husband’s death to provide sons seems so foreign to us. Although in human terms, it was a means to preserve inheritance and the name of the deceased; it was also God's means of providing for the widow. By refusing to fulfill his obligation, Onan left Tamar without any means of support in their culture.
And then we have the account of Judah refusing to allow his third son to fulfill this obligation and then visiting what he believes to be a prostitute, but is really Tamar in disguise. The whole account is less than flattering of Judah. And that begs the question: Why would such a cringe-worthy account be included in the Bible? Bearing in mind that the product of this illicit relationship, Perez, is named in the lineage of Jesus in Matthew 1, wouldn't this be one of those family stories that you just brush over? After all, hundreds of years later, who would know the circumstances of Perez' birth? Why not just record Tamar as if she were Judah's wife and leave out all the messy details? Or just leave her name out altogether, as many of the other mother’s names are omitted in the genealogies.
There's really only one explanation — because this is what happened. It isn’t a manufactured history or even one uncovered by a genealogist generations later. This painful family story was handed down one generation to the next because of the lessons learned. Tamar’s name was honored and included in the genealogies that often included only the father’s name. King David named his own daughter after her.
This chapter also reveals a critical element of God’s plan: There is judgment AND love. Anyone who tells you that there is no judgment for sin has cut some very significant portions out of the Bible. Imagine a world with no judgment, where each human does exactly as they please without any fear of consequences. It’s horrifying.
The chapter also reveals a critical truth about humans, something we probably already knew: We make a mess of things even when doing our best. In light of these truths, we must recognize that our actions have consequences, and we should seek to understand and follow God's plan.