Well, no the teacher had no right to tell you who you needed to be friends with, but the person above me is right, you should at the very least be socially polite to the girl in question so that this doesn't happen again and you two can maybe reconcile instead of being angry and fighting again. By socially polite, I mean if you happen to say, stand next to each other in line or something, just say 'Oh, hello, how are you?, goodbye" kinda deal, I don't mean to run around and become best friends
however, in all honestly, you handle the situation very badly with your teacher... She was probably just trying to settle the situation and you took it badly and yelled and cursed at her, apparently, I'm basing that completely on what you just said. That's not a very good way to handle it... and that attitude can honestly make people uncomfortable around you and even effect your friends because they hang out with you.
I'm saying that from personal experience and not to lecture and tell you what to do, so I'm sorry if you think that that's what I'm trying to do here, and I'm not trying to make you feel bad or anything, but this is what I have to say and that's really all
I hope that you don't get hurt/yelled at at anyone in school again, and that the girl will leave you alone from now on and no more trouble will come of it.