Gen 38: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.
Given an heir to his dead brother was a Jewish custom, eventually written in the scriptures
Deu 25:5. Onan’s brother, ER, was wicked in the site of the LORD, so the LORD killed him. But, ONAN DID A WICKED THING BY USING TAMAR ONLY FOR HIS SEXUAL DESIRES & not performing the duty of the husband’s brother!
Psa 55:23, But You, O God, shall bring them down to the pit of destruction; Bloodthirsty and deceitful men shall not live out half their days; But I will trust in You.
Gen 38:24, And it came to pass, about three months after, that Judah was told, saying, “TAMAR YOUR DAUGHTER-IN-LAW HAS PLAYED THE HARLOT; FURTHERMORE SHE IS WITH CHILD BY HARLOTRY.” So Judah said, “Bring her out and let her be burned!”
It amazes me that the LORD used this flawed family! HE chose this family to be in the Lineage of HIS SON JESUS! MAN IS SINFUL BY NATURE, YET GOD LOVES EACH AND EVERY ONE OF US!
Psa 86:5, FOR YOU, LORD, ARE GOOD, AND READY TO FORGIVE, AND ABUNDANT IN MERCY TO ALL THOSE WHO CALL UPON YOU.