This whole story can be read in Genesis 38.
This story is isolated to this chapter, so it has very little prior context. Maybe the only useful information is that Judah, the main character of this story, was son of Jacob, so he was very closely connected to the patriarchs of the Bible.
Judah married a Canaanite woman named Shua. Together they had three kids: Er, Onan, and Shelah.
Judah arranged for his firstborn Er to be married to Tamar: Judah’s stepdaughter. God thought Judah’s son Er was wicked, so God killed him. Judah then essentially tells his son Onan: “Go have children with your now-widowed stepsister Tamar in place of your dead brother Er”.
Onan wanted the kids to be officially his, and not be a male surrogate for his brother. So he never provided all the ingredients to his stepsister to make a baby. God didn’t like that, so God killed Onan also. (Genesis 38:9, 10)
Judah then sent his widowed stepdaughter Tamar to live with her biological father, and he instructed her to wait for his own last living biological son Shelah to grow up first, and then marry her. The passage indicates that Judah was trying to circumvent God killing his last son Shelah by delaying the marriage. (Genesis 38:11) Tamar listens to him and moves to her biological father’s house.
Later, one of Shua’s daughters died, who was unnamed in the passage. It seems as though it was not one of Judah’s biological kids, but one of his stepkids. Regardless, Judah had mourned, but was now recovered from it. He decided to go with his friend Hirah to visit his sheep shearers in Timnah.
Tamar, Judah’s widowed stepdaughter, heard that Judah was coming and changed out of her widow’s clothes, put on a veil, and sat on the path to Timnah. She did this so that Judah would have to pass her on his journey. The passage mentions that Shelah, Judah’s last son that he could offer for an arranged marriage was now grown up, but was not given to Tamar as a husband as promised. (Genesis 38:14)
When Judah saw Tamar alongside the road, the story says that he thought she was a prostitute. He approached her and asked if he could receive her services. He said that he doesn’t have the means to pay her right now, but will do so later. She asks for some kind of pledge, so he gives her his signet, cord, and staff. She then agreed to do the deed with him.
Later, Judah sent someone else to collect his pledge. However, they couldn’t find her. 3 months later, Judah heard a report that Tamar had prostituted herself. His reaction was essentially: “My daughter-in-law is a prostitute? Bring her to me and then burn her for doing evil!”
Upon arriving, she said to him: “I have proof that it was you that hired me as a prostitute and got me pregnant. These are your signet, cord, and staff aren’t they?” Judah essentially replied: “Yeah you got me. Maybe we won’t burn you alive” (Genesis 38:24-26)
End scene
Interesting. Something that strikes me is that Judah takes a journey right after grieving the loss of his stepdaughter and says in his mind “You know what I need? I could go for a prostitute right now”. The purpose of his trip was to visit his sheep shearers, and where he stopped to hire a prostitute was not the destination of his journey. It’s as though prostitution was just a pit-stop in this process, a side quest that he decided to partake in for a night.
Surely, we would think that God would kill Judah for not only hiring a prostitute while married, but impregnating his own stepdaughter of all things right? Well… no. God actually preferred earlier to kill Judah’s son Onan because he WOULDN’T impregnate his own stepsister.
On the interaction between Judah and Tamar on his journey, the narrative claims that Judah could not recognize his stepdaughter because of the veil she was wearing. The transparency of the veil comes into question, but let’s just grant that her face was indistinguishable at first. What about further along in their interaction? She never takes off the veil and he just… never sees her face at any point? If the veil is a true obstacle, he apparently couldn’t recognize her voice either. I find it interesting how Tamar also does not seem to recognize her own stepfather before or during the services as a prostitute. The account doesn’t indicate that Judah was wearing any type of disguise, so what’s the excuse there? Even if she conveniently couldn’t recognize his face, she doesn’t at least recognize his voice?
What about Tamar’s motives? She left her biological father’s house for the specific purpose of meeting up with Judah in the middle of his journey. She changed out of her widow’s clothes, into clothes that the story would later have Judah interpreting to be something that a prostitute might wear. She went to a specific spot and sat so that he would have to pass her. The story indicates that prostitutes weren't regular in that area, so prostitution doesn’t seem to be a pattern that she had, at least in that area. She dressed this way and positioned herself in this area for the purpose of seeing her stepdad, not to get random clients as a prostitute. (Genesis 38:21, 22)
I find Judah’s later response to Tamar being a prostitute as at least a bit suspicious. As soon as he heard that his stepdaughter had prostituted herself, he asked for her to be burned. Had he known all along what he had done, and wanted to get rid of the evidence? Or was he hypocritical, not yet realizing that it was her that he slept with when he himself engaged in the very act that he was condemning: prostitution?
Regardless of which it is, through the act of prostituting stepfamily came two children, one of which named Perez. Through Perez came the tribe of Judah. Through the tribe of Judah originated almost all “Jews”, as it comes from the tribe name. This specific people group were, as the Bible portrays it, God’s selected people. This people group created the line of King David, and a large portion of the Southern Kingdom of Judah. From this line, Jesus was said to have originated.
This man was a forefather to this later “great nation”. So it seems he received plot armor for his sins when his own sons who were not successors to the line of David did not recieve the same mercy.