Well, the fact that you have a right to do something doesn't mean that you should, or that it is the right thing to do. I believe that certain topics should be off the table in certain situations. One should not bring up abortion, same-sex marriage, the draft, or any other powder keg/can of worms as a topic of casual conversation.
To me, the line is quite simply respect and tact. Are you expressing your beliefs in a way that show that you understand and honor that others may have arrived at a conclusion different from yours? Saying, "I support gay marriage," while it does express a clear opinion on a somewhat divisive topic, does not disrespect or diminish the opposing viewpoint. Saying that a particular political party/religion/other group is useless is dismissive and rude.
You should not apologize for having an opinion, nor should you retract your beliefs. However, if you are disrespectful to others while you express your beliefs, you owe them an apology for that. It really depends entirely upon your delivery.
If you have simply stated your belief ("I support same-sex marriage" or "I prefer the Purple Party"), it would be illogical and unreasonable for your friend to be offended. If you have added an editorial remark about people who disagree with you ("Anybody who opposes same-sex marriage is a poopyhead" or "Only a deluded fool would support the Orange Party"), then it would be reasonable for your friend to be offended, as you have potentially just called her a poopyhead or a deluded fool, neither of which is particularly kind.
In the first instance, I would ignore the listener's offense, or remind her that we are both entitled to our beliefs and that we are grown-ups and able to discuss them calmly (or perhaps suggest that we take the topic off the table if it becomes too wrought). In the second instance, I would certainly apologize for the name-calling. "You're right. There's no need for me to say nasty things about Oranges/whatevers. I'm sorry that I did, even though I do think they are wrong about their beliefs." Then change the subject.