Can performing a haram action invalidate the fast? Does committing a forbidden (haram) action harm the fast? Is the fast broken by committing a forbidden act? Will engaging in a haram action affect the validity of the fast?
A Muslim must avoid harams everytime and everywhere, and must be more careful not to commit haram in Ramadan which is the month of fasting and worship. A person who observes fasting needs to avoid sins and act in accordance with the aim of fasting. The Prophet Muhammad (saw) said, “Whoever does not give up forged speech and evil actions, Allah is not in need of his leaving his food and drink (i.e. Allah will not accept his fasting.)” (Bukhari, Sawm, 8)
A person who observes fasting should avoid from behaviors such as gossiping, badmouthing, violating the rights of people, looking at haram, gambling etc. as well as lying and acting with lies.
Source: Presidency Of Religious Affairs The Turkey, High Board of Religious Affairs FATWAS