Summary: If grace is truly grace then it’s only given to those who don’t deserve it. And if God’s promise is to be kept then it can’t depend on those who need grace. This again points us to Christ who is our only hope.
It can be pretty frustrating when a story reaches its climax only to be interrupted by an entirely new story. Not only do we have to wait for the conclusion of the first story but we might not even care about the new one. It’s tempting to skip past Genesis 38 because we want to know what happens to Joseph; who cares about Judah? But the new story is inspired and just as worthy of our attention. This all happens while Joseph is in Egypt and it covers a period of about 20 years:
And it came to pass at that time, that Judah went down from his brethren, and turned in to a certain Adullamite, whose name was Hirah. 2And Judah saw there a daughter of a certain Canaanite, whose name was Shuah; and he took her, and went in unto her.
Judah left his brothers and married a Canaanite. Precedent has already been set many times by this family; marrying outside the family is taboo. Israelites marry Israelites. As a genereal rule the Canaanites were a distraction. They worshiped false gods and enticed Israel to do the same. At one point, when Balaam couldn’t curse the Israelites, he seduced them with women (Num. 31:15-16) and with immorality (Rev. 2:14). Judah should have known better but he doesn’t seem to mind:
3And she conceived, and bare a son; and he called his name Er. 4And she conceived again, and bare a son; and she called his name Onan. 5And she yet again conceived, and bare a son; and called his name Shelah: and he was at Chezib, when she bare him. 6And Judah took a wife for Er his firstborn, whose name was Tamar. 7And Er, Judah’s firstborn, was wicked in the sight of the LORD; and the LORD slew him. 8And Judah said unto Onan, Go in unto thy brother’s wife, and marry her, and raise up seed to thy brother. 9And Onan knew that the seed should not be his; and it came to pass, when he went in unto his brother’s wife, that he spilled it on the ground, lest that he should give seed to his brother. 10And the thing which he did displeased the LORD: wherefore he slew him also. 11Then said Judah to Tamar his daughter in law, Remain a widow at thy father’s house, till Shelah my son be grown: for he said, Lest peradventure he die also, as his brethren did. And Tamar went and dwelt in her father’s house.
The first son marries Tamar but dies before he can have children because of his own wickedness. Judah has two remaining sons to carry on his name so the situation is sad but not dire. In order to continue the line of the firstborn, Judah’s second son is tasked with impregnating his dead brother’s wife. Any child born will be counted as Er’s son. Onan doesn’t mind going in to Tamar but he doesn’t want to impregnate her. He can benefit more financially if his brother has no heir. There’s a law put into place later on that helps us understand what’s going on: If brethren dwell together, and one of them die, and have no child, the wife of the dead shall not marry without unto a stranger: her husband’s brother shall go in unto her, and take her to him to wife, and perform the duty of an husband’s brother unto her. 6And it shall be, that the firstborn which she beareth shall succeed in the name of his brother which is dead, that his name be not put out of Israel (Deut. 25:5-6).