The thing makes you think this way is semi-military system. You get in queue. Respect your teachers. Cant leave during lessons. Schools have rules to teach people social life, responsibilty, and work/adapt to a system. This is not a bad thing. And as I said its semi-military. Prisons have more like military system so with harder rules. Of course there's similar rules/functions.
Also in schools they are teaching rules to people who dont know the rules. Most of the students rule when they learn.
In prisons they are teaching rules to people who refuses to obey rules even they know them pretty good.
If you ask is there a similarity; yes in both cases they want to teach you community awareness. Because its really required. But schools have way more freedom. You cant even discuss that.