No, it is not illegal. Actually a lot of schools around the world use this as a method of punishment. In some schools there are not even janitors the kids have to clean the school themselves punishment or not.
The purpose of the 13th amendment was to abolish slavery and involuntary servitude in all of the American states.
It gave more jobs to the people who did have any