Many Christians judge masturbation to be sinful, yet no biblical prohibition exists. In fact, The Bible hardly mentions masturbation at all.
In Genesis 38:8-10, Onan has sex with his dead brother’s wife (per custom) but pulls out and spills his “seed” on the ground so Tamar won’t get pregnant. He doesn’t want to share his inheritance with the child that would result from the union. He didn’t masturbate, but it was coitus interruptus. He was punished because he was selfish.
There are also stories about God’s bride, Jerusalem, melting down gold, silver, and jewels to make male idols with which to act promiscuously. The fact that Ezekiel wrote this presumably means that his readers were familiar with the concept of a dildo. Remember, in these times, women were thought unable to control their passions.
The OT Law mentions wet dreams as making one unclean till evening. This again seems to be treated as a normal occurrence. No Biblical ban on masturbation exists. But the lack of a ban doesn’t necessarily make it good either. Just recognize here that any teaching that masturbation is “sinful according to the Bible” is not accurate.
We’ve talked about the difficult to understand texts of the Bible in their cultural contexts. We’ve explored the ways in which ideas about slavery, homosexuality, patriarchy, and masturbation have changed, failed to change over time, or never really existed with any concrete evidence. Now let’s look at one concept that has remained consistent since Christ, Paul, and countless other biblical and non-canonical writers taught about it: lust. If you want to be biblical in your sex life, you can’t avoid discussing lust.
 Ezekiel 16:17 and 23:7
 Leviticus 15:16-17