All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
It is not permissible to expose one’s 'Awrah (parts of the body that must be covered in Islam) except in case of necessity or a dire need. Just believing that one has a disease or wanting to make sure about being safe from the disease is not a sound reason for revealing one’s 'Awrah. This prohibition is even more confirmed if the 'Awrah is the private parts. However, if a trustworthy Muslim doctor determines that there is a high possibility of being affected by the disease and there is a dire need for carrying out this periodic test, then we hope that this is permissible.
In carrying out the test, the female doctor comes in priority over the male doctor, and the female Muslim doctor comes in priority over a female non-Muslim doctor. Besides, it is not permissible to show the 'Awrah more than what the necessity requires.
For more benefit, please refer to Fataawa090424 and 84882.
Finally, it should be noted that the strongest reason for the prevention from every evil or harm is relying on Allaah and earnestly asking Him for good health because it is He Who afflicts a person with diseases and it is He Who provides the cure and good health.
Allaah Knows best.