First off, there is nothing - and I mean nothing - sexual about a prostate exam. You will not be aroused, you will not be thinking sexual thoughts, you will just be having a physician examining you. If a woman who is a virgin is examined by a male gynecologist for pain and he puts a speculum inside her to take a look and see what is causing discomfort, he didn't just deflower her! Even if her hymen was broken by the speculum, it's not like she was lying there experiencing anything other than fear and dread - certainly not pleasure.
For devout Christians, virginity is lost only when two people knowingly and willingly engage in sexual behavior for the purpose of pleasure and/or procreation with one another. I assure you the Pope himself has prostate exams (esp. at his age, he'd better for his own health!). Having a female physician vs. a male one makes no difference to God, and there is nothing prohibiting medical examinations of any kind in the Bible with regard to sexual purity. Go get checked out, prostate cancer is a terrible, pernicious condition that can kill you. Nobody likes it, it's embarrassing for all men, but they do it because it's WAY better than death, which might be the alternative. Try to relax, everything will be OK between you and God.