Yes in some ways school can seem like a prison or jail because you're basically being held captive and forced to stay in the school until they let you out.
Of course you could really just walk out the school doors but if you do then the police or a truant officer will likely be out searching for you.
So yes if you look at the school in that way then it can seem like it's a prison or jail.
But with jail and prison you don't get let out at the end of the day meaning that when you go to jail or prison you stay there until your sentence is up which can be years or even until you die if you're in prison for life.
So while school can seem like a prison or jail the school is a much better place to be than being in jail or prison because with school you can go home at the end of the day and not have to sleep there and stay there day to day.