How could a good God allow sex to exist in the world?


Your question implies that "sex" is oppositional to "good." Just because man has found ways to corrupt the use of sex does not imply that sex is without a righteous purpose. See "Why is sex a sin?" for an earlier response to this falsehood.

A secondary charge in your question is that God is responsible for temptation. The implied argument is that if God had just not created sex, then I wouldn't be tempted to sin sexually. James points out the fallacy of this view. "Let no one say when he is tempted, "I am tempted by God"; for God cannot be tempted by evil, nor does He Himself tempt anyone. But each one is tempted when he is drawn away by his own desires and enticed. Then, when desire has conceived, it gives birth to sin; and sin, when it is full-grown, brings forth death. Do not be deceived, my beloved brethren" (James 1:13-16). Suppose there were two roads, one was incomplete and ended at a cliff, the other leads to a town. If I told you which road was safe and which road was dangerous, would I then be responsible if you decide to travel the road that went off the cliff? Obviously not, but you are holding God responsible for your faulty decisions. "Behold, the LORD'S hand is not shortened, that it cannot save; nor His ear heavy, that it cannot hear. But your iniquities have separated you from your God; and your sins have hidden His face from you, so that He will not hear" (Isaiah 59:1-2). See "The Nature of Law" for why God gives us a law.

Sex exists because man is mortal. We die and there is a need for others to take our place. God chose to use an act between a man and woman who have devoted themselves to each other through marriage to carry out replenishing of the earth.

"Then God blessed them, and God said to them, "Be fruitful and multiply; fill the earth and subdue it; have dominion over the fish of the sea, over the birds of the air, and over every living thing that moves on the earth."" (Genesis 1:28).

"And the LORD God said, "It is not good that man should be alone; I will make him a helper comparable to him."" (Genesis 2:18).

"Live joyfully with the wife whom you love all the days of your vain life which He has given you under the sun, all your days of vanity; for that is your portion in life, and in the labor which you perform under the sun" (Ecclesiastes 9:9).

"Behold, children are a heritage from the LORD, The fruit of the womb is a reward" (Psalm 127:3).

"Let your fountain be blessed, and rejoice with the wife of your youth. As a loving deer and a graceful doe, let her breasts satisfy you at all times; and always be enraptured with her love. For why should you, my son, be enraptured by an immoral woman, and be embraced in the arms of a seductress?" (Proverbs 5:18-20).