He vowed to marry a certain girl then he did not fulfil his vow
What the Muslim should do is avoid making vows, because the Prophet (peace and blessings of Allaah be upon him) told us not to do that.
Al-Bukhaari (6608) and Muslim (1639) narrated that Ibn ‘Umar (may Allaah be pleased with him) said: The Prophet (peace and blessings of Allaah be upon him) told us not to make vows and said: “They do not change anything, rather they are a means of making the miser give something.”
The scholars (may Allaah have mercy on them) stated that vows are of several types, such as a vow that is intended as an oath, which is aimed at encouraging an action or avoiding it.
The ruling on such vows if they are broken is that the person is given the choice between doing that action he vowed to do or offering kafaarat yameen (expiation for breaking an oath).
Ibn Qudaamah said in al-Mughni (13/461):
If a person makes a vow in the sense of making an oath, to stop himself or someone else doing something, or to make him do something – such as saying, “If I speak to Zayd, then I must go on Hajj, or give my wealth in charity, or fast for a year,” then this is an oath, and the ruling thereon is that he has the choice between fulfilling what he swore to do, in which case he does not have to do anything else, or breaking his oath, in which case he has the choice of doing what he vowed to do or offering kafaarat yameen. This is called the vow of argument and anger, and he does not have to fulfil it… This is the view of ‘Umar, Ibn ‘Abbaas, Ibn ‘Umar, ‘Aa’ishah, Hafsah, and Zaynab bint Abi Salamah. This is also the view of al-Shaafa’i. End quote.
It seems that your vow to fast for three months if you did not marry this girl is of this type, because by doing that you intended to encourage yourself to marry her. This is an oath.
See also question no. 45889.
Kafaarat yameen (expiation for breaking an oath) is mentioned in the verse where Allaah says (interpretation of the meaning):
“Allaah will not punish you for what is unintentional in your oaths, but He will punish you for your deliberate oaths; for its expiation (a deliberate oath) feed ten Masaakeen (poor persons), on a scale of the average of that with which you feed your own families, or clothe them or manumit a slave. But whosoever cannot afford (that), then he should fast for three days. That is the expiation for the oaths when you have sworn. And protect your oaths (i.e. do not swear much). Thus Allaah makes clear to you His Ayaat (proofs, evidences, verses, lessons, signs, revelations, etc.) that you may be grateful”
See also question no. 45676.
To sum up: if you marry that girl, then you do not have to do anything. If you do not marry her, then you have the choice between fulfilling your vow of fasting for three months, or offering kafaarat yameen.
And Allaah knows best.