Then Judah said to Er's brother Onan, "Go and have sexual relations with your dead brother's wife. It is your duty to provide children for your brother in this way."
But Onan knew that the children would not belong to him, so when he was supposed to have sexual relations with Tamar he did not complete the sex act. This made it impossible for Tamar to become pregnant and for Er to have descendants.
The Lord was displeased by this wicked thing Onan had done, so the Lord killed Onan also.
Then Judah said to his daughter-in-law Tamar, "Go back to live in your father's house, and don't marry until my young son Shelah grows up." Judah was afraid that Shelah also would die like his brothers. So Tamar returned to her father's home.
After a long time Judah's wife, the daughter of Shua, died. After Judah had gotten over his sorrow, he went to Timnah to his men who were cutting the wool from his sheep. His friend Hirah from Adullam went with him.
Tamar learned that Judah, her father-in-law, was going to Timnah to cut the wool from his sheep.
So she took off the clothes that showed she was a widow and covered her face with a veil to hide who she was. Then she sat down by the gate of Enaim on the road to Timnah. She did this because Judah's younger son Shelah had grown up, but Judah had not made plans for her to marry him.
When Judah saw her, he thought she was a prostitute, because she had covered her face with a veil.
So Judah went to her and said, "Let me have sexual relations with you." He did not know that she was Tamar, his daughter-in-law. She asked, "What will you give me if I let you have sexual relations with me?"
Judah answered, "I will send you a young goat from my flock." She answered, "First give me something to keep as a deposit until you send the goat."
Judah asked, "What do you want me to give you as a deposit?" Tamar answered, "Give me your seal and its cord, and give me your walking stick." So Judah gave these things to her. Then Judah and Tamar had sexual relations, and Tamar became pregnant.