In African American history, and in the more general history of our country, the term “black codes” refers to a set of laws that were passed by the various Southern states after the Civil War. These laws were meant to exert control over the freed slaves. They represent an attempt by the white Southerners to keep their dominance over the freed slaves and to ensure the continuation of their economic system even after the end of slavery.
After the Civil War, many white Southerners were very worried about their economy and society. They feared that blacks would refuse to work for them, leaving no one to work their fields. They feared that blacks might become equal to them legally and socially. Furthermore, they had to codify what rights blacks had now that they were free.
The black codes generally tried to keep tight control over blacks and their labor. For example, they typically made it illegal for a black person to be unemployed. They required black people to have valid contracts with some employer at the start of every year. Failure to do so could result in a black person being imprisoned, after which their labor could be sold.
In short, the black codes were an attempt to maintain white dominance after the Civil War. The codes infuriated the Radical Republicans and helped lead to Radical Reconstruction.