The answer by Rick Beelo discusses the role of magnesium ions in relation to catalytic mechanism, but does not include a more general and long-accepted role of the ion. This is to hold the triphosphate ‘chain’ of ATP in a specific conformation and in this and other ways to enhance the binding to the enzyme, an essential initial step in the catalysis of any reaction involving ATP. Thus, in a section of the standard undergraduate text book, Berg et al. one finds the following:
How does the binding of the magnesium ion to the nucleotide affect catalysis? There are a number of related consequences, but all serve to enhance the specificity of the enzyme–substrate interactions by enhancing binding energy.
First, the magnesium ion neutralizes some of the negative charges present on the polyphosphate chain, reducing nonspecific ionic interactions between the enzyme and the polyphosphate group of the nucleotide.
Second, the interactions between the magnesium ion and the oxygen atoms in the phosphoryl group hold the nucleotide in well-defined conformations that can be specifically bound by the enzyme…
…Third, the magnesium ion provides additional points of interaction between the ATP-Mg2+ complex and the enzyme, thus increasing the binding energy.
This latter point can be seen in the 3D structures of ATP bound to enzymes, illustrated in Figure 9.50 of that edition, where the ATP interacts with an Asp residue through two water molecules bound to the magnesium ion:
