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, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
First of all, we ask Allaah to cure you immediately from this disease and bless you with a pious wife and make you happy with children from her who would be a comfort to your eyes and who would benefit you in this worldly life and in the Hereafter.
We advise you first to repel the whispers that you have because of this disease and seek the Help of Allaah and ask Him to facilitate the cure for you. Nonetheless, you should take the means for treatment and consult the specialist doctors in this regard. Also, you should be keen on performing Ruqyah as it is beneficial, Allaah willing.
For more benefit on Ruqyah, please refer to Fataawa 88705 and 85500.
As regards whether or not this disease is hereditary, then you should also ask the specialist doctors. However, this should not be an obstacle to look for a treatment. Abu Hurayrah narrated that the Prophet said: "Indeed, Allaah has not sent down a disease except that He has sent down a cure for it.” [Al-Bukhari]
On the other hand, masturbation is a sin and an act of disobedience. As regards it being the cause of your disease or not, then we can not authoritatively assert this. However, you should repent and seek Allaah’s forgiveness for this sin, as Allaah may take away this disease from you because of that.
As regards marriage, then sterility in itself is not Islamically an impediment to marriage – even if we presume that sterility is confirmed – let alone that it is only whispers that you have in this regard. So, you should seek treatment as a way of following the guidance of the Prophet and seeking to be chaste, and you should not fear about this.
Allaah Knows best.