Er, the firstborn son, died before he and his wife Tamar could produce any children. One of the marriage traditions at the time was that a brother, in this case Onan, was duty bound to marry his brother's childless widow and produce offspring in his brother's name. This practice would later be codified by Moses (Deuteronomy 25:5). More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.