Genesis 38:7

And Er, Judah’s firstborn, was wicked in the sight of the LORD; and the LORD slew him.

Genesis 38:7 belongs to the account of the sin of Judah and his family that stands between Joseph being sold into Egypt and Joseph being bought by Potiphar, resisting temptation, being cast into prison, interpreting the dreams of Pharaoh's officers there, and then interpreting Pharaoh's dreams thirteen years after Joseph was sold. Er, Judah's firstborn, was wicked in the sight of the Lord, and the Lord put him to death. His death was a penalty in a case involving the duties of a go'el, or near kinsman, showing that the Lord's displeasure, as well as human contempt, fell on a man who shirked that duty.

The verse is an example of a person whom the Lord slew, though not for murder. The slaying of Er does not support the claim that he was executed to atone for his sins. The verse is among accounts showing the sad fruits of Jacob's mistakes in having more than one wife, including low standards of morality and crime. As part of the record of Judah's sin and wrongdoing, the verse is given to warn readers to shun sin, not to excuse it or encourage lust. The record to which the verse belongs also points to God's love, mercy, and power as the remedy for sin.

In the larger chapter, Tamar, one of Christ's ancestors, acted the part of a harlot with her father-in-law, showing that God's record of his human ancestors includes shameful histories and offers hope to the fallen. In the larger chapter, Pharez, one of Christ's human ancestors, was born of a harlot, showing a human ancestry marked by weakness and concentrating the weaknesses, passions, and sinful tendencies of fallen humanity. As part of the history of Joseph, the verse shows that whatever God has intended a person for, God can be safely trusted to bring that person to it, leading by a roundabout way yet guiding right.