Magnesium helps for many different issues. I currently take magnesium. You must see which kinds you are taking as some cause you to constantly be in the bathroom. Not pleasant. Others are better absorbed. I take Magnesium glycinate and it is a bit more expensive. There is Magnesium oxide which is the least absorbed and is the one that does cause you to be hunting for the washroom more.
I take it for kidney stones and for fibromyalgia and for anxiety. Like anything it takes your body time to adjust to it. It is more for relaxation than for anxiety though.