It's your girlfriend the one who has to tell the person (s) not to touch her. If she let anyone touch her then she like being touched. And if she comes to you and tell you that someone hasn't stop touching her after she has told the person not to touch her then you go to the Police.
You can say that, thats both protection and threat. Mostly threat. If this were to happen both the victum and victi of the situation would be sentenced to trial and they would have the right to a jury. If you had enough plead you could get away. Depends on judge, and cop. But he can report you for threat.
In spite of all the macho posturing by the adolescents above, the answer is not simple. You did not say what the circumstances are. If your girlfriend is being touched and objects to it, then you can come to her defense by telling the other person to stop or you will harm them. A threat in that situation is probably not unlawful, since the other person is clearly in the wrong and you are "using your words" instead of your fists. However if you simply walk up to someone and tell them you will harm them if they touch your girlfriend, this could be considered assault in most jurisdictions, although it would be a minor offense (low grade misdemeanor). I doubt any officer would arrest you in either situation unless your threats are completely random, but you are more at risk in the latter.