This is completely commonplace. Yes, you can be fired for doing something outside of work that would bring your employer into disrepute.
If anything this used to be much more common before the era of codes of conduct, when people were, for example, routinely fired when it was discovered that they were gay.