I'm a teacher, and I think your teacher was wrong. It's one thing to disagree with a student; it's another thing entirely to tell a student to leave the country. Unfortunately, you need to get used to it. Far too many teachers are bullies and you're in the ideological minority besides.
Anyway, I've run into this same problem myself on the other side of the classroom. I used to have an unspoken policy that my homeroom students could make their own decision regarding the pledge. They could stand and put their hand over their heart and say it, they could stand silently or they could stay seated. It worked really well until another teacher walked past my classroom when the door was open and told the principal what I was doing.
Later that day, the principal called me into his office to ask me about it. I went with the truth. I told him that this is a free country. That means people have the right to abstain from saying the pledge or standing for it or acknowledging it whatsoever. I told him that making my students stand is a rejection of the very principles on which the nation was founded. I also told him that a pledge of allegiance is an oath of fealty and something that serious should not be forced upon anyone, but especially not on children, who usually aren't mature enough to understand what such a thing means.
My principal sat in his leather office chair and quietly listened to every one of my points. He nodded his head and wrinkled his brow in thought. And then he said: "I understand, but it's a school rule that all students must stand and say the pledge of allegiance. If we let them stay seated during the pledge, what's next? They'll refuse to go to class when the bell rings!"
So my advice to you is this: Consider how far you're willing to take this. I'm proud I said what I did to my principal, but it didn't change anything. If you decide you are willing to push it, consider why: Are you motivated by your scruples or by a desire for revenge? I'm not saying revenge is a bad reason to fight back, but I do think either way, you should know why you're going to all the trouble.
I always prefer my students to be honest with me. If your teacher is worth it, talk to him before class privately. Start by telling him that he embarrassed and hurt you the other day when he called you out in front of the class. Explain your reasons for staying seated during the pledge calmly and rationally (feel free to use mine), and if he still doesn't bend, well...in five minutes you'll either be sitting or standing and I can't tell you which to choose.
Oh, by the way, if you walk past my classroom during the pledge of allegiance nowadays, all you'll see is a closed door.