When Onan had sex with Tamar, he withdrew before his orgasm and "spilled his seed [or semen] on the ground", since any child born would not legally be considered his heir. The next statement in the Bible says that Onan did evil and that God slew him.