What does Genesis 38:7 mean?
Judah (Genesis 38:1–4) has found a wife for his firstborn son Er, a woman named Tamar. While Scripture offers no details, Er's life is marked by sin such that God takes his life. Interestingly, the Hebrew name "Er" is spelled using the same two letters as the term for "evil," but in reverse. We're not told what specific sin Er committed. Most likely, it was his whole manner of life to which God objected. God's response is still startling: He puts Er to death. This might have been a direct, supernatural action. It may have been natural consequences of Er's sin (Proverbs 10:7, 27; 11:5). Regardless of the method, there is no question his death is an act of divine judgement.Though God often judges people groups for sin throughout the Old Testament, He is not often credited with directly killing an individual, outright, in response to their evil. Some commentors suggest God's intent in being so direct with Er might be to prevent Israel from producing too many heirs out of this intermarriage with the idol-worshipping Canaanite people.
Tradition, later codified into law (Deuteronomy 25:5–6), was for a surviving brother to take the widow on as his own wife. Any children produced would be heirs of the departed brother. Judah will follow this tradition, but the results will be similarly dire (Genesis 38:8–10).