The one who is fasting and has relations with his wife whilst he is fasting the optional fast, as is the case with the one who is fasting the optional fast and eats, is a matter in which the scholars have differed regarding. The madhhab of Imaam Maalik and Imaam Aboo Haneefah state that it is waajib upon that person to make up the fast, for they say that he was doing an act of obedience however he invalidated it, hence he must make up for it on another day. They cite His, the Most High, statement, "And do not invalidate your deeds" [Soorah Muhammad 47:33] whereby this person has invalidated his deed.
However, the correct opinion regarding this matter, which is also the madhhab of Imaam Ash-Shaafi'ee and Imaam Ahmad, is that whoever invalidates his optional fasting then there is no sin upon him based on the statement of the Messenger, sallallaahu 'alayhi wa sallam, "The one who is fasting the optional fast is the ameer of himself; if he wants he can continue his fast and if he wants he can break it."
Shaykh Mashhoor Hasan Salmaan
 Saheehul-Jaami' (hadeeth no. 3854)