For example, consider a prison which forces (which I'll define as however the prisons currently gets inmates to work the jobs) it's inmates to attend classes to learn job skills and avoid behaviors that landed them in prison. Would this not also be a form of slavery given they are forced to attend? Slavery isn't defined by the slave doing something useful to the owner. A slave is still a slave even if they are doing nothing or if they are being commanded to improve themselves. And in this case I wouldn't see it as immoral.
What about if the slaves are equally forced to clean up the class once done (think stereotypical Japanese school where the kids do much of the cleaning). This could potentially be saving money for the prison by reducing the number of janitors needed, but I don't see it as any more immoral that I see the kids cleaning the classroom as a form of child labor.
In a general sense, imprisoning is a subset of enslavement, though one we generally see as just as long as the laws and legal system which lead to imprisonment is seen as just. In the US in particular, we see some cases as just and some cases as unjust.