Close, with your translation I understand it as:
"The girls can wear headscarves that the college provides but they have to take them off during class"
However, while I don't know french a direct translation from google translate is:
"Girls can wear headscarves in college if they take them off in class."
This is also a native/natural sounding sentence.