He suffers from vasocongestion and pain, and the doctor advised him to masturbate

Question

I hope that you will excuse me, for Allah is not too shy to speak the truth. I am a nineteen-year-old male. Allah has blessed me with religious commitment, and I am a seeker of knowledge and a Haafiz of His holy Book. But my problem is that I suffer from the pressure of desire, which has led to the appearance of localised pain in the testicles (which is sometimes very severe) and difficulty in urination. I asked a Muslim doctor over the Internet and described the symptoms to him in detail. He told me that I am suffering from vasocongestion because of ongoing provocation and lack of draining of the fluids. Then he told me that in the event of increased provocation I have to masturbate so as to remove this congestion. Please note that I am still a student and I am not able to get married, and fasting makes me very weak (mentally and physically) I am trying as much as possible to keep away from sources of provocation, but there is no way to avoid much of it as you know, especially nowadays. I feel very ashamed of myself, especially because people look at me with respect. I have been living with a bitter psychological conflict because of this matter, because sometimes I feel that my intention is not pure when I engage in this habit. In other words, it is a mixture between dispelling the harm and attaining pleasure. Is there any sin on me if I leave this fluid in my body and do not expel it, even though I know that that may harm me and lead to infections or other complications?
My other question is: a brother suggested that I marry his daughter (without me having said anything to him previously) and he told me that he would sponsor us and even sponsor my studies. But I rejected the offer because I could not accept the idea of anyone spending on me and my wife or having any kind of advantage over me because my position would then be weak. Is what I did correct? Or should I have accepted his offer in order to keep myself chaste? If I receive such an offer again, what should I do? Is it permissible in a case like mine to get married with the intention of divorcing?

Masturbation is haraam because of evidence that we have
quoted previously in the answer to question no.
329

As it is haraam, then there is no way that it could be a
remedy, because Allah has not put healing in that which He has forbidden to
His slaves.

Ibn Mas‘ood (may Allah be pleased with him) said: Allah has
not put your healing in that which He has forbidden to you. Narrated by
al-Bukhaari in a mu‘allaq report in Kitaab al-Ashribah, Baab Sharaab
al-Halwa wa’l-‘Asl.

A person may imagine that something is a remedy when in fact
it is a disease, such as the one who imagines that there is healing in khamr
(wine, alcohol), as it says in the hadeeth that was narrated by Muslim
(3670) via Suwayd al-Ja‘fi who said that he asked the Prophet (blessings and
peace of Allah be upon him) about khamr and he forbade him or discouraged
him from making it. He said: I only make it as a remedy, and the Prophet
(blessings and peace of Allah be upon him) said: “It is not a remedy; rather
it is a disease.”

Masturbation is also like that; you may think that it is a
remedy when in fact it is a disease. The one who suffers from it can hardly
give it up and has no limit at which he can stop. With regard to fasting, it
is a beneficial prophetic remedy, but it needs to be done regularly and on
an ongoing basis, whilst also following other preventative measures such as
lowering the gaze, avoiding idleness, keeping busy with acts of worship and
obedience, and choosing righteous friends.

Some fuqaha’ allowed masturbation in cases where the
individual fears for his religious commitment or physical well-being, under
the heading of committing the lesser of two evils.

Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him)
was asked about a man who was faced with provocation of desire, so he
masturbated although he knew that the problem could be dealt with by
fasting, but it was too difficult for him.

He replied:

With regard to that (semen) that is emitted involuntarily,
there is no sin on him for that, but he has to do ghusl if the water came
out gushing. But if it was emitted voluntarily, in that he masturbated, this
is haraam according to most of the scholars. It is also one of the two views
narrated from Ahmad; in fact it is the more correct view; according to
another view it is makrooh (disliked). But if he is compelled to do that,
such as if he feared that he might fall into zina if he did not masturbate,
or he feared that he might become ill, then in this case there are two
well-known scholarly views. Some of the earlier and later scholars granted a
concession in such cases, and others forbade it. And Allah knows best.

Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: He
said: “The one who masturbates unnecessarily should be given a disciplinary
punishment.” The phrase “unnecessarily” means if there was no need to do
that. Needs are of two types: religious or spiritual needs and physical
needs.

With regard to religious or spiritual needs, that refers to
when the individual fears that he may fall into zina, if he is in a country
where it is easy to commit zina. If he experiences intense desire, he will
have two options: either he can extinguish it by doing this action or he can
go to any place where there are prostitutes and commit zina. In that case we
say to him that this is a legitimate need, because the established principle
in Islam says that it is essential to ward off the greater of two evils by
means of the lesser, and this is what is in accordance with reason. If this
person has no option but to fulfil his desire in one of these two ways, then
in that case we say that it is permissible for him to do this action because
it is a case of necessity.

With regard to physical needs, that refers to when the
individual fears that some harm may befall his body if he does not discharge
this fluid from his body, because some people may experience strong desire,
and if this accumulating fluid is not discharged it will result in
psychological problems, so he will not like to mix with people or sit with
them.

So if he fears some kind of physical harm, then it is
permissible for him to do this action because it is a physical need. But if
there is no need and he does this action, then he should be given a
disciplinary punishment that will serve as a deterrent.

End quote from ash-Sharh al-Mumti‘, 14/318

Secondly:

You should avoid anything that may provoke desire of looking,
listening, reading and so on, and you should avoid keeping company with
those whose company may lead to that, so as to protect your religious
commitment and your physical well-being. Please see the answer to question
no. 20161 for some advice on
resisting the danger of sexual temptation.

Thirdly:

If a man offers to give you his daughter in marriage and to
spend on you both, and this man is religiously committed and righteous, and
there is no fear that he will break his promise or remind you of his
kindness later on, then there is nothing wrong with accepting that from him;
perhaps this is provision that Allah has granted to you and a way out by
which you can be safe from falling into haraam.

As for marrying with the intention of divorcing, that is
haraam, because it involves deceiving and cheating the wife. This has been
discussed previously in the answer to question no.
111841

We ask Allah to make things easy for you, purify your heart
and protect your chastity.