Magnesium oxide and sulfide spinels have recently attracted interest as cathode and electrolyte materials for energy-dense Mg batteries, but their observed electrochemical performance depends strongly on synthesis conditions. Using first-principles calculations and percolation theory, we explore the extent to which spinel inversion influences Mg2+ ionic mobility in MgMn2O4 as a prototypical cathode, and MgIn2S4 as a potential solid electrolyte. We find that spinel inversion and the resulting changes of the local cation ordering give rise to both increased and decreased Mg2+ migration barriers, along specific migration pathways, in the oxide as well as the sulfide. To quantify the impact of spinel inversion on macroscopic Mg2+ transport, we determine the percolation thresholds in both MgMn2O4and MgIn2S4. Furthermore, we analyze the impact of inversion on the electrochemical properties of the MgMn2O4 cathode via changes in the phase behavior, average Mg insertion voltages and extractable capacities, at varying degrees of inversion. Our results confirm that inversion is a major performance limiting factor of Mg spinels and that synthesis techniques or compositions that stabilize the well-ordered spinel structure are crucial for the success of Mg spinels in multivalent batteries.