Praise be to Allah.
If the wife is menstruating, she does not have the right to be masturbated by her husband’s hand, because that involves touching the impurity, unless that is done from behind a barrier.
Please see the answer to question no. 152885
If the husband is safe from touching the impurity, then there is nothing wrong with it.
There is nothing wrong with the husband kissing his wife, touching her and being intimate with her, without having intercourse, when he is fasting, because the Prophet (blessings and peace of Allah be upon him) used to kiss his wife when he was fasting, and he used to touch his wife when he was fasting. But if he fears that he may end up doing that which Allah has prohibited to him, because he is easily aroused, then it is makrooh for him to do that. If he ejaculates, then he must refrain from eating and so on for the rest of the day, and he must make up that day’s fast. As for madhiy, that does not invalidate the fast.
It is permissible for a man to enjoy intimacy with his wife when he is fasting, so long as he does not have intercourse or ejaculate.
If you are confident that you can avoid touching the impurity, and there is no fear that you will have intercourse with your wife or ejaculate without having intercourse with her, whilst you are fasting, then there is nothing wrong with you doing that.
What should be done – indeed must be done – in the case of someone like you, a young man who is recently married, is delay that until night-time, because the ability of a young man to control himself or control his desire is limited, and matters are very likely to get out of hand, in which case you would end up doing something that is prohibited and you would render your act of worship invalid.
Therefore, when the Mother of the Believers ‘Aa’ishah (may Allah be pleased with her) narrated that the Messenger of Allah (blessings and peace of Allah be upon him) used to kiss his wives and touch them when he was fasting, she followed that with a statement that there was no fear in the case of the Prophet (blessings and peace of Allah be upon him) that matters would get out of hand or that he would do that which is prohibited.
Al-Bukhaari (1826) and Muslim (1106) narrated that ‘Aa’ishah (may Allah be pleased with her) said: The Messenger of Allah (blessings and peace of Allah be upon him) used to kiss and touch (his wife) when he was fasting, but he was the most able of you to control his desire.
An-Nawawi (may Allah have mercy on him) said:
Ash-Shaafa‘i and his companions said: Kissing one’s wife when fasting is not prohibited for one whose desire will not be provoked, but it is better for him not to do that. But it cannot be said that it is makrooh for him; rather they said that it is contrary to that which is preferable in his case, even though it is proven that the Prophet (blessings and peace of Allah be upon him) used to do that, because in his case (blessings and peace of Allah be upon him) there was certainty that he would not go beyond the limit of kissing, whereas in the case of others there is the fear that he will go beyond that limit, as ‘Aa’ishah said: “but he was the most able of you to control his desire.”
In the case of one whose desire will be provoked, it is haraam for him, according to the more correct view of our companions. And it was said that it is makrooh. al-Qaadi said: A number of the Sahaabah and Taabi‘een, and Ahmad, Ishaaq and Dawood, stated that it is permissible for one who is fasting in all cases. Maalik regarded it as makrooh in all cases. Ibn ‘Abbaas, Abu Haneefah, ath-Thawri, al-Awzaa‘i and ash-Shaafa‘i said it is makrooh for a young man but not for an old man. This was also narrated from Maalik. Ibn Wahb narrated from Maalik (may Allah have mercy on him) that he regarded it as permissible during a supererogatory fast but not during an obligatory fast.
There is no difference of opinion concerning the fact that it does not invalidate the fast unless the individual emits maniy as a result of kissing.
End quote from Sharh Muslim by an-Nawawi
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said:
That is indicated by the fact that it is permissible for the one who can control himself, but not for the one who is not certain that he will not fall into that which is prohibited.
End quote from Fath al-Baari.
Moreover, the concession allowing intimacy with a wife who is menstruating is also limited by the condition that the husband be confident that he will not fall into that which is not allowed or that which Allah has prohibited:
Al-Bukhaari narrated in his Saheeh (296) that ‘Aa’ishah (may Allah be pleased with her) said: When one of us was menstruating, if the Messenger of Allah (blessings and peace of Allah be upon him) wanted to be intimate with her, he would tell her to wrap something around her waist, then he would be intimate with her.
She said: and who among you can control his desire as the Prophet (blessings and peace of Allah be upon him) used to control his desire?
The practice of the Prophet (blessings and peace of Allah be upon him), as reported in the hadith of ‘Aa’ishah mentioned above, and similar reports, was to be intimate with his wife from above the waist wrapper that she tied around herself, which is something that covers the area between the navel and the knee, or from above something that covered her private part, if the period had gone on for a long time and the bleeding had become less.
In fact a number of scholars are of the view that it is haraam to be intimate with a menstruating woman involving the area between the navel and the knee, except from above the waist wrapper. This is the well-known view narrated from Maalik, Abu Haneefah and ash-Shaafa‘i.
See: Fath al-Baari by Ibn Rajab (2/27 ff)
And Allah knows best.