Answered by Shaykh Faraz Rabbani
A person when he was young, 1. didn’t know that he had to intend before fasting so he fasted without intention although he did got up for suhur. 2. mastrubated while fasting, He didn’t know that mastrubating invalidates a fast. should this person make up these fast or is he excused because he was ignorant of the above two points.
Walaikum assalam wa rahmatullah,
The intention is a given in Ramadan. It is merely to have the resolve to fast, such that if you were asked at night, “Are you fasting tomorrow?” you would say, “Yes.” A clear sign of the intention is to resolve to get up for the pre-dawn meal (suhur). (Tahtawi/Shurunbulali, Hashiyat Maraqi al-Falah)
Masturbation is sinful, and even more so in Ramadan. If it results in ejaculation it invalidates the fast. One must repent and make up such fasts.
Fasting Questions: Intention & Accidents