To invoke the KJV euphemism, Judah "went in unto" a certain Canaanite woman, who bore him Er, Onan, and Shelah. To this day, when Englishmen having trouble finding the right words to say, they invoke the name of Judah's firstborn.
Er marries Tamar, who is soon widowed because the LORD slays him for reasons only known to God. Onan was then ordered by his father to "go in unto" Tamar and duly impregnate his late brother's widow. He goes in to her alright, but pulls out of her at the last moment, thus spilling his seed and demonstrating to posterity that the ancient Semites knew at least one method of birth control. The LORD, never one for a disobedient smartass, slays Onan for failing to go all the way. And thus down to this very day the practice of coitus interruptus with one's sister-in-law is referred to as Onanism. Wait, wait, that's not what it means?
One might be tempted to think that Onan's story is the only bizarre sexual incident involving Tamar in this chapter of the Bible, but wait, there's more! Judah impregnates his daughter-in-law without ever looking her in the face because he thinks she is a working girl. Maybe it was custom back then never to look a prostitute in the face? Certainly this would open up the field of competition.
At any rate, Judah becomes wroth when his daughter-in-law, the widow of both Er and Onan, starts to show as pregnant. He commands that she be burned alive (seems a bit harsh) but then she provides the proof of purchase which he had given her as a receipt for services rendered. Alas, Judah, you are the dastard who knocked up this hapless woman! Perhaps you should both be burned alive?