I am so sorry this happened to you. I can tell you that I experience a similar issue young in my career.
How you handle this is going to be based on your experience in the workplace. Here are some options you might consider . . .
Option 1 - Thank her for her feedback, then tactfully remind your boss that her statements are illegal and discriminatory. Let her know that your hard work, diligence, and commitment to your job are what qualifies you for a promotion - not your hair. Then explain to her that if she considers you a strong enough employee to promote, she should know that your excellent record will only benefit her in the long run. After all, why would she want to promote someone of less talent, just because she liked their hair?
Option 2 - Thank her fer her feedback. Change your hair, get the promotion, and then go back to wearing you hair the way you always do (or not).
Option 3 - Make an appointment with HR and do number 1 in the HR offices.
If your hair does not prohibit you from doing your job in a safe, sanitary, and productive way then she has no right to make those statements. She sounds incredibly immature with little work experience behind her. She probably thinks she is helping you. If I am wrong in that statement and she is an experienced women making those comments, then option 3 would be my choice.
Whatever you decide to do, you must do the right thing for YOU - not her and not a job. Jobs come and go, but our esteem stays with us. You have to step back from the situation, assess, and decide based on you.