Where did the tradition of "men wear pants, women wear skirts/dresses" come from?

by emiluuh

I teach English in Japan and the majority of schools over elementary education require the students to wear gendered uniforms - i.e., the girls have skirts and the boys have pants.

It got me thinking - where exactly or what sort of events happened that led to the gendered ideas of skirts being for women, pants for men? Was this a cultural norm accepted around many cultures or did it spread from one area and influence others? How old is this tradition?

Thanks so much in advance!

kochikame