In the United States Miscegentation laws were laws that banned interracial marriage and sometimes sex between members of two different races and were enforced in the Thirteen Colonies from the late seventeenth century onwards, and subsequently in several US states and US territories until 1967.
The laws were gradually repealed state-by-state during the period 1948-1967, however, the southern slave states were notoriously slow and some of these states waited till 1998 to fix language in their constitutions.
Similar laws were also enforced in Nazi Germany, from 1935 until 1945, and in South Africa during the Apartheid era, from 1948 until 1984.
The history of these laws is complex and lengthy. See the related link for a more complete discussion.