Question: do baseball players have to wear hats?
Answer: In all seriousness though, if you look at the MLB dress code, there's actually NOTHING there as it pertains to wearing a cap out on the field. Caps are only mandatory if you interpret the first rule of the dress code (“All players on a team shall wear uniforms identical in color, trim and style”) as applying to them.