Seems like if you’re on an away mission to, say, a desert planet, sunglasses might be useful.
To a degree. Not all species need them, and it might not be considered necessary. Particularly since it adds the risk of you losing them, and inadvertently causing a violation of the Prime Directive.
Species like Vulcans have innate defences that are just as good, if not better than 21st century sunglasses, and they may rely on those instead.