Genesis 38:9

And 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.

Cross-references

Genesis 19:31 shows Lot's daughters acting to preserve their father's line — a contrast to Onan's refusal to preserve his brother's.

Deuteronomy 25:6 states the purpose of levirate marriage — the firstborn son carries the dead brother's name, which Onan deliberately prevented.

Ruth 4:10 Contrast

Ruth 4:10 shows Boaz marrying Ruth to raise up the deceased's name — the very duty Onan here refuses by spilling his seed.

Deuteronomy 25:5 Historical context

Deuteronomy 25:5 codifies the levirate law Onan was expected to follow — his act violated this command.

Ruth 1:11 Parallel

In Ruth 1:11, Naomi says she has no more sons for Ruth to marry — the same levirate concern for providing a brother to continue the family line.