No. You do not have to take your sun glasses off. In fact, I recommend leaving them on. When you're pulled over, the police are trying to put together enough evidence to make an arrest. Almost every DUI police report I've read says two things:
1. "strong odor of alcohol", and
2. that the suspect had "glassy eyes."
Now of course these observations are often untrue and falsely asserted in the police report, but they can't even pretend you had "glassy eyes" if you were wearing sunglasses. And imagine if they check off the "glassy eyes" box anyway? That's a pretty good officer credibility argument.
I agree with Mr. Loncar. Often officers will state things like that and in court it is treated as a request rather than an order. It is unclear what the circumstances were surrounding this incident. If you were arrested, you should ist down with an attorney.
This is not intended as individual legal advice and there is no attorney client relationship established by this answer. It is advisable that you seek individualized legal assistance. This is not a substitute for hiring an attorney.
The responses provided here are sound LEGAL responses. But the practicalities and realities of the situation may be a bit different. You don't take off the glasses, you convince the officer that you have something to conceal. Something the officer will see (and report) anyway. And you annoy him/her. If s/he winds up arresting you, s/he takes them off for you (so they won't/can't be used as a weapon). Some would argue that provoking the officer when you are hooked up for DUI is not a sound strategy, because it can lead to a number of small additional incremental aggravations for your case. But I guess opinions can differ on that.
My responses to questions on Avvo are never intended as legal advice and must not be relied upon as legal advice. I give legal advice only in the course of an attorney-client relationship. Exchange of information through Avvo's Questions forum does not establish an attorney-client relationship with me. That relationship is established only by individual consultation and execution of a written agreement for legal services.
Legally you are probably on sound footing to politely say to the officer that unless it is required you prefer to keep your glasses on. Now practically it's probably not a sound tactic. Reality is that upsetting a police officer in the field comes with a price. The price depends on how professional the police officer is and how experienced. You draw the wrong police officer and you can find yourself spending a few hours appeasing a manufactured investigation.