The basic principle is that both spouses are obliged to keep the secrets of the marital relationship between themselves only, and not to disclose them to others.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked:
Some women often tell their relatives and friends about things that are said at home and their marital relationships with their husbands, and some of these things are secrets of the house that the husbands do not want anyone to know about. What is the ruling on the women who disclose these secrets and tell them to people outside the household or to some members of the household?
What some women do of telling their relatives and friends about things that are said at home and their marital relationships is haraam. It is not permissible for a woman to disclose the secrets of her household or her relationship with her husband to anyone. Allah, may He be exalted, says (interpretation of the meaning): “Therefore the righteous women are devoutly obedient (to Allah and to their husbands), and guard in the husbands absence what Allah orders them to guard” [an-Nisa’ 4:34]. And the Prophet (blessings and peace of Allah be upon him) stated that “The worst of people in status before Allah on the Day of Resurrection will be a man who was intimate with a woman, and she was intimate with him, then he discloses her secrets.”
End quote from Fataawa Islamiyyah, 3/211, 212
But if there is a real need to mention something of that nature, there is nothing wrong with doing so, on condition that one does not mention more than needs to be mentioned, and that is said only to those who need to know about it, when there is the hope that a genuine interest may be served thereby.
It says in ‘Awn al-Ma‘bood (6/158):
If there is a need for that, or some benefit may be served thereby, then it is not makrooh to mention it, such as if a woman states that her husband is not having intercourse with her and claiming that he is impotent and so on, as it was narrated that a man whose wife claimed that he was impotent said: O Messenger of Allah, I am very strong and can satisfy her.” And he did not rebuke him for saying that.
But in the case of this woman who has told all her relatives, undoubtedly this is a grave mistake and it comes under the heading of disclosing the secrets of the husband and exposing him to shame in a way that she has no right to.
Moreover, it is contrary to modesty, dignity and sound conduct.
The husband is obliged to treat his wife honourably, because Allah, may He be exalted, says (interpretation of the meaning): “And live with them honourably” [an-Nisa’ 4:19]. Part of treating her honourably is intercourse, which is obligatory for him to the extent that is sufficient for her. If he is not able to do that, then she has the right to annul the marriage after referring to the qaadi (judge).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
Shaykh al-Islam (Ibn Taymiyah – may Allah have mercy on him) favoured the view that she has the right to annulment of the marriage if he is unable to have intercourse. He said: His inability to have intercourse is more deserving of annulment than his inability to spend on her maintenance. The correct view is that of the shaykh, because often women want intimacy with the husband and they want children more than they want wealth, and they do not care about wealth in such situations. But if we say that if he is unable to spend on maintenance then she has the right of annulment, but if he is unable to have intercourse she does not have the right of annulment unless it is proven that he is impotent – this is subject to further discussion.
The correct view is that of the shaykh (may Allah have mercy on him): if he is unable to have intercourse because of illness, and she asks for an annulment, then it is be granted, unless this sickness is something that is known or thought most likely to be curable or likely to change. In that case she does not have the right to annulment, because it is expected to be cured.
End quote from ash-Sharh al-Mumti‘, 12/410
But from the question it appears that the man has consulted doctors and they have told him that he is medically sound, yet despite that he is unable to have intercourse.
However there is no reason why he should not consult qualified doctors again, in order to confirm that he is physically and psychologically sound. This may be the effect of magic that was done against them, which is known as rabt (something that restrains him) or sihr as-sarf (something that diverts him from what he wants to do). This type of magic has the effect, by Allah's leave, of preventing intercourse. Allah, may He be exalted, says (interpretation of the meaning):
“And from these (angels) people learn that by which they cause separation between man and his wife, but they could not thus harm anyone except by Allah’s Leave”
Our advice to you is to turn to Allah and to call upon Him and seek His help by means of the prescribed ruqyahs, whether you recite it over yourself or you go to raaqis who are trustworthy in terms of their ‘aqeedah (belief) and are known not to be charlatans.
It says in Fath al-Baari by Ibn Hajar (10/233):
Ibn Battaal stated that in the books of Wahb ibn Munabbih it says that one may take seven green lotus leaves and crush them between two stones, then add water to them and recite into it Aayat al-Kursiy and the soorahs that begin with “Qul (Say)” [al-Ikhlaas, al-Kaafiroon, al-Falaq and an-Naas] , then take three sips of it, then wash oneself with it, and it will take away all problems in his body, and this is good for a man who has been prevented from having intimate relations with his wife.
Shaykh Ibn Baaz (may Allah have mercy on him) said:
Another remedy for sihr (witchcraft) after it has taken place, which is a good remedy for a man who has been prevented from having intercourse with his wife, is to take seven green lotus leaves, crush them with a stone and the like, put them in a vessel and pour over them enough water to wash oneself. He should recite into (the water) Aayat al-Kursiy, Soorat al-Kaafiroon, Soorat al-Ikhlaas, Soorat al-Falaq and Soorat an-Naas; and the verses about witchcraft from Soorat al-A‘raaf, which are the verses in which Allah, may He be exalted, says (interpretation of the meaning):
“And We inspired Moosa (Moses) (saying): ‘Throw your stick,’ and behold! It swallowed up straight away all the falsehoods which they showed.
Thus truth was confirmed, and all that they did was made of no effect.
So they were defeated there and then, and were returned disgraced”
[al-A ‘raaf 7:117-119]
and the verses in Soorat Yoonus:
“And Firaun (Pharaoh) said: ‘Bring to me every well-versed sorcerer.’
And when the sorcerers came, Moosa (Moses) said to them: ‘Cast down what you want to cast!’
Then when they had cast down, Moosa (Moses) said: ‘What you have brought is sorcery, Allah will surely make it of no effect. Verily, Allah does not set right the work of Al-Mufsidoon (the evil-doers, corrupts, etc.).
‘And Allah will establish and make apparent the truth by His Words, however much the Mujrimoon (criminals, disbelievers, polytheists, sinners, etc.) may hate it.’”
and the verses in Soorat Ta-Ha:
“They said: ‘O Moosa (Moses)! Either you throw first or we be the first to throw?’
(Moosa (Moses)) said: ‘Nay, throw you (first)!’ Then behold, their ropes and their sticks, by their magic, appeared to him as though they moved fast.
So Moosa (Moses) conceived a fear in himself.
We (Allah) said: ‘Fear not! Surely, you will have the upper hand.
‘And throw that which is in your right hand! It will swallow up that which they have made. That which they have made is only a magicians trick, and the magician will never be successful, no matter whatever amount (of skill) he may attain.’”
After reciting what is mentioned above into the water, he should drink from it three times, and wash himself with what is left. By this means the malady will disappear, in sha Allah. If he needs to use it two or more times, until the malady disappears, there is nothing wrong with that.
Another remedy for sihr, which is one of the most beneficial remedies, is to try hard to find out where the sihr (items used to cast the spell) is, in what land or on what mountain or anywhere else, because if it can be found, taken out and destroyed, the spell will be broken.
End quote from Majmoo‘ Fataawa Ibn Baaz (3/279)
And Allah knows best.