Magnesium and aluminum are abundant metals in the Earth’s crust and widely utilized in industrial engineering. Under high pressure, these elements can form elemental compounds into single substances, resulting in a variety of crystal structures and electronic properties. In this study, the possible structures of magnesium-aluminum alloys are systematically investigated in a pressure range of 0–500 GPa by using the first-principles structure search method, with energy and electronic structure calculations conducted using the VASP package. Bader charge analysis elucidates atomic and interstitial quasi-atom (ISQ) valence states, while lattice dynamics are analyzed using the PHONOPY package via the small-displacement supercell approach. Eight stable phases(MgAl
3-
Pm\bar 3
m, MgAl
3-
P6
3/
mmc, MgAl-
P4/
mmm, MgAl-
Pmmb, MgAl-
Fd\bar 3
m, Mg
2Al-
P\bar 3
m1, Mg
3Al-
P6
3/
mmc, Mg
3Al-
Fm\bar 3
m) and two metastable phases (Mg
4Al-
I4/
m, Mg
5Al-
P\bar 3
m1) are identified. The critical pressures and stable intervals for phase transitions are precisely determined. Notably, MgAl-
Fd\bar 3
m, Mg
2Al-
P\bar 3
m1, Mg
4Al-
I4/
m and Mg
5Al-
P\bar 3
m1 represent newly predicted structures. Analysis of electronic localization characteristics reveals that six stable structures (MgAl
3-
Pm\bar 3
m, MgAl
3-
P6
3/
mmc, MgAl-
Pmmb, MgAl-
Fd\bar 3
m, Mg
2Al-
P\bar 3
m1 and Mg
3Al-
P6
3/
mmc) exhibit electronic properties of electrides. The ISQs primarily originate from charge transfer of Mg atoms. In the metastable phase Mg
4Al-
I4/
m, Al atoms are predicted to achieve an Al
5–valence state, filling the p shell. This finding demonstrates that by adjusting the Mg/Al ratio and pressure conditions, a transition from traditional electrides to high negative valence states can be realized, offering new insights into the development of novel high-pressure functional materials. Furthermore, all Mg-Al compounds display metallic behaviors, with their stability attributed to Al-p
-d orbital hybridization, which significantly contributes to the Al-3p/3d orbitals near the Fermi level. Additionally, LA-TA splitting is observed in MgAl
3-
Pm\bar 3
m, with a splitting value of 45.49 cm
–1, confirming the unique regulatory effect of ISQs on lattice vibrational properties. These results elucidate the rich structural and electronic properties of magnesium-aluminum alloys as electrodes, offering deeper insights into their behavior under high pressure and inspiring further exploration of structural and property changes in high-pressure alloys composed of light metal elements and p-electron metals.