In many societies the law did not (or does not) give illegitimate persons the same rights of inheritance as legitimate ones, and in some, not even the same freedoms. In Victorian England, for example, illegitimacy carried a strong social stigma among middle class people, as it did in the United States then, as well. As recently as the 1940s and 1950s there, unwed mothers were strongly encouraged to give their children up for adoption. Oft times, an illegitimate child would be raised by grandparents or married relatives as the "sister" or "nephew" of the unwed mother, just as in medieval and Renaissance Europe priest's children (especially bishop's and pope's children) were usually called their "nephews," giving us the term "nepotism". In those cultures the fathers of bastard children did not incur the same censure nor, generally, much legal responsibility.
By the latter third of the 20th century in the U.S., all the states had adopted uniform laws that codify the responsibility of both parents to provide support and care for a child regardless of their parents' marital status and giving illegitimate (and adopted) persons the same rights to inherit their parents' property as anyone else. Generally speaking in the United States illegitimacy has been surplanted by the concept "born out of wedlock". One does not speak of a child being illegitimate, all children are equally legitimate.
Today the word "bastard" remains both a pejorative epithet and an acceptable adjective for describing odd-sized objects or parts, such as bolts with non-standard threads.