Genesis 38:8-10 Then Judah said to Onan, “Go in to your brother’s wife, and perform the duty of a brother-in-law to her, and raise up offspring for your brother.” 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. And what he did was displeasing in the sight of the LORD, and he slew him also.
This involved what is known as the “levirate law”: the duty to produce offspring with the wife of a dead brother. But this is not why God killed Onan, since the penalty for that was public humiliation and shunning, not death (Deut 25:5-10). Context also supports this interpretation, since immediately after this (Gen. 38:11-26), is the story of Onan’s father Judah refusing to enforce the law and allow his other son, Shelah to produce a child with Tamar, his daughter-in-law. He was afraid that Shelah would be killed like Onan and his other wicked son, Er (38:7,11). Judah acknowledges his sin in 38:26: “She is more righteous than I, inasmuch as I did not give her to my son Shelah.” He wasn’t killed, so it is unreasonable to contend that Onan was judged and killed by God for the very same sin that Judah committed (in the same passage). Onan was judged for contraception (sex with the deliberate intent to unnaturally prevent procreation).
There are a host of other biblical passages which exalt fertility and the blessing of many children, and the curse of none. Married couples are to “be fruitful and multiply”; this is a blessing:
Genesis 1:28 And God blessed them, and God said to them, “Be fruitful and multiply, . . .” (cf. 9:1,7)
Genesis 28:3 God Almighty bless you and make you fruitful and multiply you, that you may become a company of peoples.
Genesis 35:11 And God said to him, “I am God Almighty: be fruitful and multiply; a nation and a company of nations shall come from you, and kings shall spring from you.” (cf. Dan 3:35-36)
Deuteronomy 7:13-14 he will love you, bless you, and multiply you; he will also bless the fruit of your body and the fruit of your ground, your grain and your wine and your oil, the increase of your cattle and the young of your flock, in the land which he swore to your fathers to give you. You shall be blessed above all peoples; there shall not be male or female barren among you, or among your cattle.
Psalm 107:38 By his blessing they multiply greatly; . . . (cf. Is 48:18-19; Jer 29:6; 30:19-20; 33:22; Ezek 36:10-12; Bar 2:34)
Psalm 115:14 May the LORD give you increase, you and your children! (cf. 105:24)
Psalm 128:3-4 Your wife will be like a fruitful vine within your house; your children will be like olive shoots around your table. Lo, thus shall the man be blessed who fears the LORD.
Proverbs 17:6 Grandchildren are the crown of the aged, and the glory of sons is their fathers. (cf. 11:30; Sir 44:13,21)
Barrenness is contrary to blessing and “glory”:
Exodus 23:25-26 You shall serve the LORD your God, and I will bless your bread and your water; and I will take sickness away from the midst of you. None shall cast her young or be barren in your land; . . .
Jeremiah 18:21 Therefore deliver up their children to famine; give them over to the power of the sword, let their wives become childless and widowed. . . .
Hosea 9:11 E'phraim's glory shall fly away like a bird -- no birth, no pregnancy, no conception!
Procreation is central to marriage:
Malachi 2:14-15 You ask, “Why does he not?” Because the LORD was witness to the covenant between you and the wife of your youth, to whom you have been faithless, though she is your companion and your wife by covenant. Has not the one God made and sustained for us the spirit of life? And what does he desire? Godly offspring. So take heed to yourselves, and let none be faithless to the wife of his youth.
Childbearing is so sacred that women are even said to be “saved” by it:
1 Timothy 2:15 Yet woman will be saved through bearing children, if she continues in faith and love and holiness, with modesty.
It is God Who opens and closes wombs and causes a conception to occur:
Genesis 20:17-18 Then Abraham prayed to God; and God healed Abim'elech, and also healed his wife and female slaves so that they bore children. For the LORD had closed all the wombs of the house of Abim'elech because of Sarah, Abraham's wife.
Genesis 29:31 When the LORD saw that Leah was hated, he opened her womb; but Rachel was barren.
Genesis 30:2,22-24 Jacob’s anger was kindled against Rachel, and he said, “Am I in the place of God, who has withheld from you the fruit of the womb?” . . . Then God remembered Rachel, and God hearkened to her and opened her womb. She conceived and bore a son, and said, “God has taken away my reproach”; and she called his name Joseph, saying, “May the LORD add to me another son!”
Exodus 1:21 And because the midwives feared God he gave them families.
Joshua 24:3 Then I took your father Abraham from beyond the River and led him through all the land of Canaan, and made his offspring many. I gave him Isaac;
Ruth 4:13 So Bo'az took Ruth and she became his wife; and he went in to her, and the LORD gave her conception, and she bore a son.
1 Samuel 1:5 and, although he loved Hannah, he would give Hannah only one portion, because the LORD had closed her womb.
Job 10:8,11 Thy hands fashioned and made me; and now thou dost turn about and destroy me. . . . Thou didst clothe me with skin and flesh, and knit me together with bones and sinews. (cf. 12:10)
Job 31:15 Did not he who made me in the womb make him? And did not one fashion us in the womb?
Psalm 113:9 He gives the barren woman a home, making her the joyous mother of children. Praise the LORD!
Ecclesiastes 11:5 As you do not know how the spirit comes to the bones in the womb of a woman with child, so you do not know the work of God who makes everything.
Isaiah 44:2 Thus says the LORD who made you, who formed you from the womb and will help you: . . . (cf. 44:24; 54:1-3; Ezek 36:37; 2 Mac 7:22-23)
Children are a gift from God and a blessing:
Genesis 17:16,20 I will bless her, and moreover I will give you a son by her; I will bless her, and she shall be a mother of nations; kings of peoples shall come from her . . . As for Ish'mael, I have heard you; behold, I will bless him and make him fruitful and multiply him exceedingly; he shall be the father of twelve princes, and I will make him a great nation. (cf. Deut 30:9,15-16; Is 51:2)
Genesis 29:32-33 And Leah conceived and bore a son, and she called his name Reuben; for she said, “Because the LORD has looked upon my affliction; surely now my husband will love me.” She conceived again and bore a son, and said, “Because the LORD has heard that I am hated, he has given me this son also”; and she called his name Simeon.
Genesis 33:5 And when Esau raised his eyes and saw the women and children, he said, “Who are these with you?” Jacob said, “The children whom God has graciously given your servant.”
1 Chronicles 25:5 “All these were the sons of Heman the king’s seer, according to the promise of God to exalt him; for God had given Heman fourteen sons and three daughters.”
Psalm 127:3-5 Lo, sons are a heritage from the LORD, the fruit of the womb a reward. Like arrows in the hand of a warrior are the sons of one's youth. Happy is the man who has his quiver full of them! . . . (cf. 72:16; 113:9)
Tobit 4:12 . . . Remember, my son, that Noah, Abraham, Isaac, and Jacob, our fathers of old, all took wives from among their brethren. They were blessed in their children, and their posterity will inherit the land. (cf. Sir 25:7)