Nope! It's one of those things where it can certainly benefit people who want to do it and enjoy it or otherwise find a benefit to doing it, but it doesn't hurt anyone who doesn't. And if it was something a person felt they had to do and did when they didn't want to, that could do emotional harm.
Your best bet is talking to whoever is treating your OCD, but in general, if you're having sexual thoughts that make you uncomfortable, that's probably not about sexual frustration. Masturbation also probably won't make those thoughts any less bothersome or frequent, and thinking about things that trouble you deeply while masturbating could instead cause you more distress.
What do YOU want to do (or not do)?
Never doubt that a small group of thoughtful, committed citizens can change the world. Indeed, it is the only thing that ever has. - Margaret Mead