Someone who betrays his country during a war would be called a turncoat. If you suddenly start supporting a rival sports team, you might be called a turncoat, too. A turncoat is a traitor.
Turncoat comes from the ancient practice of wearing a badge or pin on one's coat signifying the party or leader you supported. By "turning your coat" you quite literally hid your allegiance to others. Often used interchangeably with defector, and while they are similar they are not quite the same. Turncoat is worse: it implies no possibility of any good or honest motive. Defector can at least sometimes have a neutral or even positive implication.