All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Masturbation is forbidden in the month of Ramadan and at all other times, and there is no difference in this between a man and a woman.
At virtuous times, like in Ramadan, it is more sinful, but it does not invalidate the fast if it occurred at night because the night is not a time for fasting in principle. But it invalidates the fasting and it necessitates to make up for it if it happens during the day.
The Fatwa of the Standing Committee for Issuing Fataawa reads:
"Masturbation is forbidden and it is not permissible to practice it during the night or during the day. Doing it during Ramadan is more sinful and it is a greater and more serious a sin because of violating the sanctity of the month and the honor of the time.” [End of quote]
Allah knows best.