Hakama is men’s formal wear, but in the Heian era it is said that both men and women wore them. After that period, women’s hakama were omitted, but in the Meiji era its easiness to move was recognized, and people started to wear them again. Nowadays, it is common to wear them in graduation ceremonies.
There are Andonbakamas which is like a skirt, and Umanoribakama which is like pants, but the original hakama is umanoribakama. Andonbakama is a simplified hakama to make it easy to wear, but nowadays these two are regarded as equal in class, and there is no difference in formality. When wearing hakama, you wear your kimono a little short in length, and men wear Tunoobi and tie them in Ichimoji style, and women wear Hanhaba-obi and tie them in Bunko style. The knot of the obi goes underneath the hakama, and thus becomes the foundation. When you put your leg in the hakama, you lift your front side, and you adjust your hakama so your obi shows a little from the top; then you pull the string to the backside of your body, then to your front, and finally to your back again and tie it. Next, you lift the back part up above your obi, and bring the string to your front, then to your back, and finally tie it in your front. There is a formal way to tie it, but when wearing them in daily occasions (not formal occasions), bow knot is just fine.