Luther on Onan....
Genesis 38:9. But Onan knew that the offspring would not be his; so when he went in to his brother's wife, he spilled the semen on the ground, lest he should give offspring to his brother.
10. And what he did was displeasing in the sight of the Lord, and He slew him also.
Onan must have been a malicious and incorrigible scoundrel. This is a most disgraceful sin. It is far more atrocious than incest and adultery. We call it unchastity, yes, a Sodomitic sin. For Onan goes in to her; that is, he lies with her and copulates, and when it comes to the point of insemination, spills the semen, lest the woman conceive. Surely at such a time the order of nature established by God in procreation should be followed. Accordingly, it was a most disgraceful crime to produce semen and excite the woman, and to frustrate her at that very moment. He was inflamed with the basest spite and hatred. Therefore he did not allow himself to be compelled to bear that intolerable slavery. Consequently, he deserved to be killed by God. He committed an evil deed. Therefore God punished him.
And this is what I meant when I said that the probity of those who kept this law was outstanding. For it is a great burden to serve another by raising up and preserving descendants and heirs, to beget children for others, to rear and nourish them, and to leave them a patrimony--and all this in the name of a dead brother. The world knows nothing at all of such love. It is a great annoyance to be only a guardian and tutor of wards, which customarily takes place nowadays according to Roman law. How many complaints and what perfidy are found there throughout the whole world! For it is a difficult task and a mark of outstanding love to be faithful and diligent in protecting the goods of others. Accordingly, this law includes the most ardent love. That worthless fellow refused to exercise it. He preferred polluting himself with a most disgraceful sin to raising up offspring for his brother.
Luther, M. (1999, c1965). Vol. 7: Luther's works, vol. 7 : Lectures on Genesis: Chapters 38-44 (J. J. Pelikan, H. C. Oswald & H. T. Lehmann, Ed.). Luther's Works. Saint Louis: Concordia Publishing House.