I believe they can. I believe they can even request your social media credentials, despite that being against the ToS for those sites. It's not against the law to refuse, but they can and will reject entry on that basis.
In other words, 2FA might actively put you in danger. Something to consider before travel and perhaps temporarily lowering your digital security to preserve your physical one.