Praise be to Allah.
Masturbation is prohibited based on the evidence of the Qur’an and Sunnah. For more information please see the answer to question no. 329.
This sin is compounded if the sin was committed in a place or at a time of special virtue, especially if the time at which that deed was done was a time that was singled out for an act of worship. That is obviously contrary to what was intended by the Lawgiver.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) was asked about the sin of disobedience and the hadd punishment for zina: is it increased during blessed days or not?
Yes, sins during the days of particular virtue or in places of particular virtue are compounded and the punishment is greater, commensurate with the virtue of the time and place.
End quote from Majmoo‘ al-Fataawa (34/180).
The increase in the punishment is in terms of intensity, not in amount.
For more information, please see the answer to question no. 38213
Masturbation is one of the things that are prohibited when in a state of ihram (for Hajj or ‘umrah). Whoever masturbates and ejaculates does not spoil his Hajj or ‘umrah, according to the majority of scholars (may Allah have mercy on them), because there is no evidence to suggest that his pilgrimage is rendered invalid thereby, and it is not valid to draw an analogy with intercourse, because of the differences between the two.
It says in al-Mawsoo‘ah al-Fiqhiyyah (4/102): Hajj is not invalidated by masturbation, according to the Hanafis, Shaafa‘is and Hanbalis, but Hajj is invalidated thereby according to the Maalikis. They said that it must be made up and a sacrifice offered, even if the person did that out of forgetfulness, because he ejaculated as a result of doing something that is prohibited whilst in ihram.
In this regard, ‘umrah is like Hajj, according to the Hanafis, Shaafa‘is and Hanbalis. This is what may be understood from the general meaning of the words of al-Baaji among the Maalikis. But the apparent meaning of the words of Bahraam and others suggest that with regard to what invalidates Hajj in some cases, in terms of intercourse and ejaculation, in the case of ‘umrah a sacrifice must be offered (to absolve it), because the matter is less serious, in the sense that it (‘umrah) is not obligatory. End quote.
The one who masturbates during ‘umrah – whether a man or a woman – must offer a fidyah according to the correct scholarly view, but the scholars differed as to what must be offered. The Hanafis said that a sheep must be sacrificed. The Shaafa’is said that a fidyah like that required for shaving one’s head whilst in ihram (as in the case of one suffering from an ailment in his scalp) must be offered in this case, and this fidyah is a choice between sacrificing a sheep, feeding six poor persons, or fasting for three days.
This is the view of the Hanbalis.
An-Nawawi (may Allah have mercy on him) said in al-Majmoo‘ (7/307):
With regard to masturbation, it is haraam, and there is no difference of scholarly opinion, because it is haraam when one is not in a state of ihram, so when one is in a state of ihram, it is more appropriate that it should be haraam.
If the pilgrim in ihram masturbates and ejaculates, is he required to offer a fidyah? There are two views:
The correct, well-known view is that he must offer a fidyah.
The second view is that he does not have to offer a fidyah. But the correct view is that he must offer a fidyah.
Then he (may Allah have mercy on him) also said (7/417):
If we say that he must offer a fidyah, then it is the same as the fidyah for shaving the head [whilst in ihram], as we said concerning being intimate with a woman without engaging in intercourse. But his Hajj is not rendered invalid by masturbation, and there is no difference of opinion concerning that. End quote.
The words “and there is no difference of opinion” mean: in the Shaafa‘i madhhab.
See: Sharh Muntaha al-Iraadaat (1/550، 556)
It says in Durar al-Hikaam Sharh ‘Gharar al-Ahkaam (1/246):
It says in al-Jawharah: In the event of ejaculation as a result of masturbation, a sheep must be offered as a sacrifice, according to Abu Haneefah, but the Hajj or ‘umrah is not invalidated thereby. If he did not ejaculate, then he does not have to offer any fidyah. End quote.
The view that what must be offered is a fidyah like that required for shaving one’s head whilst in ihram is the view regarded as more likely to be correct by Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him). He said:
With regard to touching without desire, such as if a man holds his wife’s hand, this is not haraam, but if the touching is with desire, then it is haraam, whether that touching with desire is done with the hand or with any other part of the body, and whether it is done with or without a barrier in between, because that detracts from the rituals and may lead to ejaculation.
Then, after mentioning the views of the scholars of the madhhab, he said:
The correct view is that it is not obligatory to sacrifice a camel for intimacy (less than intercourse); rather what is required is the same as what is required in the event of any other action that is prohibited whilst in ihram." (Ash-Sharh al-Mumti‘ 7/163)
He (may Allah have mercy on him) also said:
With regard to the fidyah, the actions that are prohibited whilst in ihram are divided into four categories:
1. that for which no fidyah is required, which is doing a marriage contract;
2. that for which a severe penalty (fidyah) is required, which is intercourse during Hajj before the first stage of exiting ihram
3. that for which the fidyah is to offer as a sacrifice an animal that is equivalent (to the one killed), which is killing game animals;
4. that for which the fidyah is a fidyah like that required for shaving one’s head whilst in ihram, which applies to all other actions that are prohibited whilst in ihram.
This categorisation covers everything and if the seeker of knowledge learns it, he will put his mind at rest concerning this issue.
The fidyah like that required for shaving one’s head whilst in ihram is either to feed six poor persons, giving each one half a saa‘, or to fast for three days, consecutively or separately, or to sacrifice a sheep, which is to be slaughtered and the meat distributed to the poor, because Allah, may He be exalted, says (interpretation of the meaning):
“And whosoever of you is ill or has an ailment in his scalp (necessitating shaving), he must pay a Fidyah (ransom) of either observing Saum (fasts) (three days) or giving Sadaqah (charity - feeding six poor persons) or offering sacrifice (one sheep)” [al-Baqarah 2:196].
Based on the above:
Your previous ‘umrah is valid, but you have to offer a fidyah like that required for shaving one’s head whilst in ihram because of what you committed of masturbation. The marriage that took place after that is valid, in sha Allah, and there is no need to repeat the marriage contract, even if the fidyah had not been offered at that time. All that is required is to discharge your duty by offering what you owe of the fidyah, which is to sacrifice a sheep and distribute its meat to the poor of the Haram, or to feed six poor persons among the poor of the Haram, giving each one half a saa‘, or to fast three days in any place.
And Allah knows best.