Yes magnesium can help with anxiety.
When your magnesium levels are low and you're already suffering from anxiety your anxiety levels can increase so by taking magnesium supplements you can help ease your anxiety.
I suffer from anxiety myself and take magnesium supplements and when I do take magnesium supplements my anxiety gets better.
I calm down easier when I have increased my magnesium intake.
Don't overdose on the magnesium though and only take a few magnesium supplements daily and only increase your dose if you speak with your doctor.
Your doctor can also prescribe some medication that can help calm your nerves and ease the anxiety as well.