Of course you may wear sunglasses while batting or taking physical exercise ,especially outdoors. Because by wearing sunglasses outside, the lenses will serve to protect you from taking sun beams, which is harmful to your fragile eyes. And in this way, you can see things more clearly and accurately, not distracted from strong light beams. Basically, there`re no side effects by wear them, once they are properly used, and you are good to go. Anyway, sunglasses are suitable for outdoor sports.
It depends on how fierce when you play bat. If you want to enjoy bat seriously, you'd better not wear common sunglasses because it may slide off your nose or broken that further lead damages to your. In fact, you can wear sports sunglasses, or known as goggles. It will shield your eyes when you play bat. But they maybe not so cool as fashion sunglasses give. Anyway, keep eye health and safety is the prime important things.