Is wearing sunglasses healthy or unhealthy for your eyes?

Usually healthy. Make sure that the sunglasses block uv rays. They will usually say "blocks uva/uvb" on the side. There were some problems with sunglasses that blocked visible light well, allowing the pupil to dilate, but they did not block uv (ultraviolet rays) well, so they let even more uv rays in than wearing no sunglasses. Most modern or quality sunglasses block uv rays well.
Healthy. We consider the use of sunglasses like using sunscreen on your skin. They help cut glare and reduce cataract and pinguecula formation. There is some evidence to suggest they can help reduce lifetime risk from macular degeneration. There really is no downside to wearing sunglasses.
Healthy. Look for 100% blockage of uva and uvb light polarized lens help a lot to reduce glare photochromatic lenses adjust to light, but sometimes the change is too slow and incomplete, so nice to have separate pairs.