There is much in the New Testament that echoes the Old Testament, highlighting the fact that God had been preparing his people for the arrival of the Messiah for thousands of years.
Among the many similarities are the lives of St. John the Baptist and Samson.
Samson
In the book of Judges, we read that an angel of the Lord proclaimed to Samson’s mother that her child is to be a Nazarite, consecrated to the Lord:
And the angel of the Lord appeared to the woman and said to her, “Behold, you are barren and have no children; but you shall conceive and bear a son. Therefore beware, and drink no wine or strong drink, and eat nothing unclean, for lo, you shall conceive and bear a son. No razor shall come upon his head, for the boy shall be a Nazirite to God from birth; and he shall begin to deliver Israel from the hand of the Philistines.”
Judges 13:3-5
Daniel Esparza wrote an article for Aleteia that explains the history of the Nazarite vow, pointing out the etymology of the word:
The word Nazirite derives from the Hebrew nazir. It has, perhaps not surprisingly, the same overtones found in the Latin sacer — both words imply that something or someone has been “consecrated” and,consequently,“separated” from the rest. Scholars explain the notion of the sacred (that is what both nazir and sacer literally mean) intends to explain the remarkable character of that which is considered as such by highlighting its uniqueness. Whatever is deemed sacred is, by its very nature, already somehow “apart” from the rest.
Samson was set apart by God for a specific mission and lived his life in a way that reflected it.
St. John the Baptist
In a similar way, St. John the Baptist is framed as someone who was set apart and an angel spoke to his father with nearly identical words:
And you will have joy and gladness,
and many will rejoice at his birth;
for he will be great before the Lord,
and he shall drink no wine nor strong drink,
and he will be filled with the Holy Spirit,
even from his mother’s womb.
Luke 1:14-15
The Catholic Encyclopedia explains that, “Foremost among [the Nazarites] is generally reckoned John the Baptist, of whom the angel announced that he should “drink no wine nor strong drink.’ He is not explicitly called a Nazarite, nor is there any mention of the unshaven hair, but the severe austerity of his life agrees with the supposed asceticism of the Nazarites.”
Essentially we will never know on this earth whether or not St. John the Baptist took a Nazarite vow, but he certainly was set apart in a similar way as Samson and was consecrated by God for a specific mission.