You will probably have to declare it when you apply. And even if you don't have to, you should. This is much more for your benefit than for the university - being aware of a diagnosis like that will allow them to offer you appropriate support should you need it.
And there's no reason you couldn't study medicine if you have OCD if it is well-controlled and not significantly affecting your life. Even if you are still struggling with it somewhat, so long as you are able to be safe and competent and personally able to handle the stress, I'm sure it will be fine. Obviously these decisions are made on a case-by-case basis. There are plenty of mdical students and doctors who struggle with mental illness, you will not be alone by a long shot