I'd like to say that they legally have no right to enforce a certain hair code, but I actually have no idea on the matter. However, if another employee has long hair, that means that it is discrimination.
If every employee has short hair, then that might not work.