"And I will give him to the LORD all the days of his life, and no razor shall come upon his head" (I Samuel 1:11). There we have learned: Samuel was a Nazirite, according to the words of Rabbi Nehorai. But has it not already been said, "How can I go? If Saul hears it, he will kill me" (I Samuel 16:2)? Already the fear of a creature of flesh and blood was upon him. Rabbi Levi said: "Fear shall not come there, the fear of briers and thorns" (compare Isaiah 7:25). Just as this brier fears nothing except iron, so too this hair fears nothing except iron. [That is: only the iron razor, not ordinary fear, would have power over Samuel's untouched Nazirite hair.]
Was Samuel a Nazirite and Why Iron Could Frighten Him
Yalkut Shimoni on Nach 78:11
ונתתיו לה' כל ימי חייו ומורה לא יעלה על ראשו. תמן תנינן נזיר היה שמואל כדברי ר' נהוראי והלא כבר נאמר איך אלך ושמע שאול והרגני כבר היה עליו מורא של בשר ודם. א"ר לוי לא תבא שמה יראת שמיר ושית מה הדין (שערא) [סירא] לא מפחדא אלא מפרזלא אף הדין שערא לא פחדא אלא מפרזלא: