Medical masturbation?

Actually, there is.
Somewhat fringe cases, but still.

Don't. Whether you do it with lustful thoughts or not, you still become a servant to the pleasure/relief if you do it, and Jesus said that you cannot serve two masters. You're asking whether or not its sinful to use this as a "remedy", but God is the remedy you should be searching for.

It's a recurrent bait.

That's a great story. How many little anons have you got now?

Also if a man is infertile is he allowed to masturbate or use contraceptives, or should he remain celibate?

Why would you need contraceptives if you're infertile?
Also, nice get

Don't taint your mind with it.
I don't know what the solution is, but from my judgment, I would masturbate in that situation, without looking at porn or letting myself be deceived by lust.
Might be impossible though. I can't think of a prayer to say before or after doing that deed…
Ask your priest.

Lmao because the Church makes up teachings right? I mean everyone knows Jesus founded the Baptist Church all the apostles and early fathers were actually fans of pastor Anderson.
Funniest post I've seen today.

Actually I've got a friend of mine that needs to take the pill because she bleeds a lot when they have that weird days of the period. That's a medical reason.
If she is lying she is sinning and will go to hell.

You can get married unless you're impotent. More sexual freedom inside marriage other than the regular stuff is beyond my knowledge

No then it's fine because you're not doing it simply out of lust