It's an order of the court. The person is in jail, so it amounts to jail. If they don't follow the order, then they get punished. It's as simple as that. So it's the same as if they were in jail and then got caught with drugs—they go into segregation. So there's no difference. They have no choice. They must follow the order.
That's not true on probation, where they have to agree to it.