The US Constitution's 13th Amendment abolishing slavery specifically allows it for convicted people. [1]
You'll see from the definition of a "slave" [2] that prisoner labor specifically fits the definition of a slave, hence why the constitution makes an exception for it.