The incident in 1 Chronicles 2:3, is mentioned in Gen. 38:7, but we are not given details of what he did that was so wicked. There are a number of cases in Scripture where God lost patience with certain people, and took their lives. See Gen. 38:10 for another such incident involving Er’s brother, Onan. God also killed a husband and wife because they told one lie (see Acts 5:1–10 for details).
1 Chronicles 2:3 The sons of Judah were Er, Onan, and Shelah. These three were born to him by the daughter of Shua, the Canaanitess. Er, the firstborn of Judah, was wicked in the sight of the Lord; so He killed him.