Magnesium may not be effective at terminating atrial fibrillation, but it does play a vital role in normal heart function. If you have atrial fibrillation, it is not uncommon that your doctor will order blood work which includes magnesium.