Judah chose a wife for his firstborn son Er. Her name was Tamar.
Er angered the LORD. So the LORD took away his life.
Then Judah said to Onan, "Go sleep with your brother's widow. Do your duty for her as a brother-in-law, and produce a descendant for your brother."
But Onan knew that the descendant wouldn't belong to him, so whenever he slept with his brother's widow, he wasted his semen on the ground to avoid giving his brother a descendant.
What Onan did angered the LORD so much that the LORD took away Onan's life too.
Then Judah said to his daughter-in-law Tamar, "Return to your father's home. Live as a widow until my son Shelah grows up." He thought that this son, too, might die like his brothers. So Tamar went to live in her father's home.
After a long time Judah's wife, the daughter of Shua, died. When Judah had finished mourning, he and his friend Hirah from Adullam went to Timnah where the men were shearing Judah's sheep.
As soon as Tamar was told that her father-in-law was on his way to Timnah to shear his sheep,
she took off her widow's clothes, covered her face with a veil, and disguised herself. Then she sat down at the entrance to Enaim, which is on the road to Timnah. (She did this because she realized that Shelah was grown up now, and she hadn't been given to him in marriage.)
When Judah saw her, he thought she was a prostitute because she had covered her face.
Since he didn't know she was his daughter-in-law, he approached her by the roadside and said, "Come on, let's sleep together!" She asked, "What will you pay to sleep with me?"