Is it permissible for an HIV positive person to masturbate?.
A person who is a carrier of the virus or who has AIDS may get married to a woman who is healthy or who also has the disease, if she accepts that after coming to know of his condition and to what extent he is affected, and they may agree not to have children, or not to have intercourse. The husband may be masturbated by his wife, and there is no sin on him for that.
But it is not permissible for him to get married without informing the woman of his sickness, because concealing it is deceit and is haraam. If he conceals it then the wife finds out, she has the right to annul the marriage.
Masturbation is haraam, as has been explained in question no. 329.
But if the person who has AIDS cannot get married, and he is afraid that he may fall into zina (fornication), it is permissible for him to masturbate, so as to choose the lesser of two evils.
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) said: With regard to ejaculating by choice, if he masturbates with his hand, this is haraam according to most of the scholars, and it is one of the two reports narrated from Ahmad, in fact it is the more correct of the two. According to another report it is makrooh, but if he is compelled to do that, such as one who fears that he may fall into zina if he does not masturbate, or he fears that he may become ill, then in this case there are two well known scholarly views and in this case a number of the earlier and later scholars granted a concession, whereas others forbade it. And Allaah knows best. End quote from al-Fataawa al-Kubra (1/302).
It says in Sharh al-Muntaha (3/366): Whoever masturbates with no need, man or woman, his action is forbidden and he should be disciplined for that because it is a sin. But if he does it for fear of committing zina or homosexuality, then there is no punishment, and if he does it for fear of physical harm the same applies, and more so. But it is not permissible for a man to masturbate with his hand unless he is unable to get married, because if he is able to get married there is no need for that. End quote.
And Allaah knows best.