Question: If a Muslim is so sexually excited during the daytime in Ramadaan that he cannot help masturbating, does this invalidate Sawm? Does doing so necessitate making up for the day (or days) or offering a Kaffaarah (expiation)?
Answer: Masturbation during Ramadaan and at other times is Haraam. It is unlawful to do so based on the Saying of Allaah: And those who guard their chastity (i.e. private parts from illegal sexual acts). Except from their wives or the (women slaves) whom their right hands possess – for (then) they are not blameworthy. But whosoever seeks beyond that, then it is those who are trespassers. Anyone who practices it during the daytime in Ramadaan while fasting has to repent to Allaah and make up for the Sawm of the respective day. However, it does not necessitate Kaffaraah because it is prescribed specifically in the case of sexual intercourse... read more here.