Question: I masturbated in Ramadhan and I did not know that masturbation is haram. How should I go about my previous fasts?
Answer: If you knew in the beginning that masturbation is haram and that it invalidates fasting, you should observe qadha and give kaffara. The kaffara is to either feed sixty poor and needy Shia people or fast for sixty days (31 days in a row). If you did not know its ruling and masturbated due to inculpable (innocent) ignorance, your fast is in order and qadha is not necessary.