Joseph (whose brothers tried to kill him and left him down a well) was sold into slavery in Egypt. Joseph was good at being a house servant, and his master made him his personal servant. Joseph was trusted with the household, and with this God blessed the entire house. The masters wife took a liking to Joseph, and continuously asked him to sleep with her. Joseph always refused, seeing the act as a sin against God. One day she came onto him by grabbing his cloak. Joseph ran away, leaving his cloak in her hand. She then told the other servants and her husband that Joseph tried to have his way with her, but her screams prevented it. The master of the house had Joseph imprisoned. God remained with Joseph while in prison, causing the jailer to be well disposed towards Joseph. Joseph was put in charge of the prisoners, and just about anything else that had to be done.
Judah, one of Jacob’s sons marries an unnamed woman. With her he has 3 sons: Er, Onan, and Shelah. Er marries Tamar, but he greatly offended God, so God killed him. Judah then gives Tamar to Onan saying,
“Have intercourse with your brother’s wife, in fulfillment of your duty as brother-in-law, and thus preserve your brother’s line.”
Onan knew that any child conceived with Tamar would be considered his brothers, so every time they had sex, he pulled out. This made God angry, and God killed him. Judah then sent Tamar back to her father’s house, telling her to wait until Shelah grows up. Time passes, and Judah’s wife dies. After he mourns he goes to visit the people who shear his sheep. Tamar is told of his journey, and she takes off her widow’s clothes and wraps herself in a shawl, and waits for Judah to pass. At this point Shelah has grown up, but Tamar has not been given to him. When Judah passes her, he thinks she is a prostitute, and does not recognize her as his daughter-in-law. For the price of a young goat he has sex with Tamar. After, Tamar goes home and back to being a widow. When Judah becomes aware that Tamar is pregnant, she is accused of being a prostitute. Tamar then reveals that it is Judah’s child she is carrying, and he says that she is in the right, because he did not give her to Shelah. Tamar is not burned to death, and has twins.