It's technically optional in most institutions, but not practically optional. For instance, a lot of labor can reduce your sentence, can give you better housing and can enable you to afford things on commissary you might need (e.g. phone time, hygiene products etc).
Not 100% true it seems, but happy for someone else to correct me.
> Prison labor in the US is mostly optional - https://en.wikipedia.org/wiki/Penal_labor_in_the_United_Stat...