1 It came to pass at that time that Judah departed from his brothers, and visited a certain Adullamite whose name was Hirah.
2 And Judah saw there a daughter of a certain Canaanite whose name was Shua, and he married her and went in to her.
3 So she conceived and bore a son, and he called his name Er.
4 She conceived again and bore a son, and she called his name Onan.
5 And she conceived yet again and bore a son, and called his name Shelah. He was at Chezib when she bore him.
6 Then Judah took a wife for Er his firstborn, and her name was Tamar.
7 But Er, Judah’s firstborn, was wicked in the sight of the Lord, and the Lord killed him.
8 And Judah said to Onan, “Go in to your brother’s wife and marry her, and raise up an heir to your brother.”
9 But Onan knew that the heir would not be his; and it came to pass, when he went in to his brother’s wife, that he emitted on the ground, lest he should give an heir to his brother.
10 And the thing which he did displeased the Lord; therefore He killed him also.
11 Then Judah said to Tamar his daughter-in-law, “Remain a widow in your father’s house till my son Shelah is grown.” For he said, “Lest he also die like his brothers.” And Tamar went and dwelt in her father’s house.
The events in this chapter are referred to in Genesis 46:12, in David’s genealogy in 1 Chronicles 2:3-4, Ruth 4:12, and in Jesus’ genealogy in Matthew 1:3.
Adullam was a small Canaanite settlement about eight miles northwest of [Jacob’s] home. Some commentaries condemn Judah—perhaps rightly—for choosing a wife from the Canaanites, but what other options did he have? Laban’s family was not only closely related, but they were idol worshipers and antagonistic toward Jacob. Esau’s and Ishmael’s families had both mixed with the Canaanites. The Bible doesn’t tell us Tamar’s background.
Morris’ quote (below) is speculation but compelling enough, I thought, to be included here:
Shua’s daughter … was a true Canaanite, not only in parentage but in character, and was evidently unwilling to be converted to the worship of Jehovah. It is true that the Bible does not say this, but the inference is justified in view of the fact that all three of her sons were rejected by God from carrying on in Judah’s patriarchal line. Two of them, at least, were notoriously wicked, and it is likely that their characters largely reflected their mother’s character and teaching. — Morris, page 547
Er = watcher (named by Judah). His wickedness in the sight of the Lord may have been, in part, a refusal to consummate his marriage. Or, since God planned to include Tamar as an ancestor of the Messiah, it may be that God put Er to death before Tamar could conceive by him.
Onan = strong (named by his mother)
Shelah (also named by his mother), born in Chezib, apparently a small town near Adullam. He never did marry Tamar, but he did marry someone because he became the ancestor of the Shelanites, in the tribe of Judah (Numbers 26:20).
It was already a custom in those days that, if a man died without children, his next younger brother should marry his wife and “raise up seed to his brother.” The first son from such a marriage would then be recognized legally as the son and heir of the dead brother. This was the so-called Levirate marriage, which later was incorporated as a part of the Mosaic law (Deuteronomy 25:5-1-; Matthew 22:24). The obvious step [after Er had died], therefore, was to enforce the Levirate (a word from the Latin levir, meaning “brother-in-law”) regulation … and to have Tamar marry Judah’s second son, Onan. …
It was not the overt act of spilling the seed on the ground that occasioned Onan’s death, but rather his rebellion against his duty to give Tamar a son. Judah either didn’t know why his first two sons died, or else suspected that Shelah would sin in the same way and “also die like his brothers.” — Morris, page 549
__________