In short, yes.
However, this all depends on the placement of the straw.
It should not rest against your teeth or even touch them. Instead, position it towards the back of your mouth to avoid any contact with your teeth. And after you sip, don’t swish around your drinks. Letting liquids linger before swallowing allows them to creep into tooth crevices, increasing the risk for cavities.
When drinking with a straw, just remember: sip, swallow and smile.