What happens to magnesium in water with acid?
In water Mg oxidizes and the half-reactions are:
$$\ce{Mg -&gt; Mg^{2+} + 2e-}$$
$$\ce{2H2O + 2e- → H2 + 2OH-}$$

As the E($\ce{Mg}$/$\ce{Mg^{2+}}$)>E($\ce{H2O}$/$\ce{H2}$), Mg oxidizes and water reduces.

Metal ions can change their speciation depending on the pH. In acidic conditions $\ce{Mg^{2+}}$ dissolves and associates with malate (which in solution is deprotonated) and end up precipitating because the malate is in high concentration and the solution is saturated. And, in neutral o basic conditions they precipitate as metal hydroxides which are quite insoluble. 

What you have to take into account is that metal ions can precipitate in basic conditions and dissolve in acidic ones. 
Also, water has a reduction potential and has to be taken into account in rusting processes with metals. You can look for more information with Pourbaix diagrams where you can see the changes in speciation of metals in front of pH and the reduction potential of several metals.

Here's the Pourbaix diagram of Mg:


I hope this helps!