Slave codes, in African American history, are the laws that regulated slaves and the relations between slaves and their owners. The slave codes were meant mainly to ensure that African American slaves would be subjugated as much as possible.
Slavery did not just start as a fully-fledged system in the American colonies and then in the United States. It gradually developed over time. As it did so, it needed a whole set of laws to govern it. There had to be laws to govern whether a slave owner could simply kill a slave the way he could destroy some other kind of property. There needed to be laws that determined the sort of permission a slave needed if they were to be allowed away from their home and owner. There had to be laws to determine whether a slave could work for wages or could defend themselves if attacked by a white person.
The slave codes regulated all of these things and more. They integrated slavery into the legal system in the states where it existed. It helped to ensure that the slave system would continue and that African Americans would be kept “in their place” relative to whites.