Marriage in Islam is a solemn contract that is founded upon mutual understanding, love, affection, respect, etc. Both the husband and wife have specific rights and obligations that guarantee the stability of the marital life. Among these rights are intimate relations. Neither spouse can deny the other this right.
as for masturbation, it should be clear that masturbation is generally considered forbidden in Islam since it is deemed to fall under the category of sexual satisfaction outside the framework of marriage. However, when it is the only choice instead of committing the major sin of Zina (fornication or adultery), one can resort to it without exaggeration bearing in mind that he/she should do his/her best to satisfy his/herself within marriage. So, the ruling on masturbation is governed by some considerations that might change the ruling from one person to another.
Sheikh Muhammed Nur Abdullah, President of ISNA (Islamic Society of North America) and member of the Fiqh Council of North America, states: “From the Shari`ah point of view, a wife has the right to conjugal relations the same way the husband has. It is NOT allowed for the husband to deny his wife this right, as it is one of the basic rights of the wife in the Islamic marriage. That is why the scholars have said that if someone is unable to practice sexual relations at all, the wife has the right to seek divorce.
however, the situation in your case is different, as you have a child and problems between you and your husband have to be resolved in a wiser way. Besides, you didn’t mention how long he stays away from you. In the narration from `Umar ibn al-Khattab (may Allah be pleased with him) the maximum period of staying away from one’s wife is six months, after which the person will be considered sinful.
As for masturbation, it is not allowed in your case, and what you have mentioned cannot be considered a ground for it, especially when we see that it contradicts with the verse in which Allah says: “And who guard their modesty. Save from their wives or the (slaves) that their right hands possess, for then they are not blameworthy.” (Al-Mu’minun: 5-6)
In general, it is not allowed for your husband to abandon you or deny you this right. However, I would advise you to speak with your husband frankly and never be shy from him because you are demanding your right.”