It's not impossible, but unlikely. More likely, similar lifestyle and diets lacking in foods which are supplying B12, (e.g., beef, liver etc., which is why vegans usually use B12 and other supplements) and sufficient amount of absorbable magnesium (e.g., magnesium oxide is the most popular form sold in stores, but nearly useless, except for softening / laxative effect, because less than 7% of it is actually absorbed by the body.)
Magnesium also has certain smooth muscle-relaxing effect, so that's another way it might help alleviate muscle pain and reduce instances of tension / migraine headaches.