As far as I know, sometimes the driver will see better if they wear sunglasses while driving. For example, donning a pair of polarized sunglasses can help you see through the downpour better though in rainy days the water make the road hard to see. And drivers can see better with sunglasses in the night. What's more, it protects drivers' eyes from hurting by outer things.
People wear sunglasses for their own safety. Mostly, the light can be pretty annoyed when people drive. If they don't wear sunglasses they'd probably put themselves in danger if they can't see things clearly.
Especially, people need to wear sunglasses when they drive in summer.