How can one atone for breaking the fast in Ramadan by masturbating? Should he fast two months in expiation?
Knowingly breaking the fast is a great sin. One should atone for it. However, we cannot say that one must do that. This view is based on the following narrative ascribed to the Prophet (sws):
A man came to the Prophet (sws). He said: "I have been ruined, O Messenger of God!" The Prophet (sws) asked him what had ruined him. The man replied: "I have had sexual intercourse with my wife while fasting." The Prophet (sws) asked him whether he had something to buy a slave his freedom. The man replied in the negative. The Prophet (sws) then asked him if he could continuously fast for two months. He again replied in the negative. The Prophet (sws) asked him whether he could feed sixty needy people. He again replied in the negative. Then he sat there. Meanwhile, a basket full of dates was presented to the Prophet (sws). The Prophet (sws) asked him to give away the basket of dates in the way of Allah. At this, he said: "Who would need these more than me! There is no house between these two barren plains of Madīnah needier of these dates than mine." At this the Prophet (sws) smiled such that his teeth could be seen. Then the Prophet (sws) said to him: "Go and feed your family with these." (Muslim, No: 1111)
It needs to be appreciated that the above relates only to breaking fast by something that is allowable otherwise. As for those who indulge in lewd acts must learn that their acts amount to making a mockery of the divine commands. For our view on the act of masturbation please refer to: Masturbation.