Students may not like wearing a uniform to school. But it can teach some valuable lessons later in life.
When you dress for work, having experience wearing a uniform every day, makes it easier for students to know what is acceptable attire for work, especially if you are working in an office. When I was in business school, one student showed up regularly in tracksuits. They might have been expensive but were not office attire.
Also, when students are all wearing the same thing at school, it is harder for them to see what socio-economic backgrounds the students come from. Some students may be richer than others but they wear the same uniform so they all look alike.