When I first joined the Navy, beards were allowed by uniform regulation (no War of 1812 jokes please
). I remember being told that no successful officer would have a beard. On the enlisted side of the house, beards were more common but
could impede advancement to the Chief Petty Officer paygrade. Plenty of CPOs had beards, but people sent pictures to the advancement boards in those days and it could have an impact (advancement below CPO was and is by examination with no board). Even today, mustaches are far more common among enlisted than officers, in large part because any facial hair can impede advancement.
This rule is not written down, there are always some exceptions, but the easiest thing to do is to follow the unwritten guidance if you want to move up. Sounds like you face the same thing.