First ionisation enthalpy is the energy required to remove the most loosely bound electron from a neutral gaseous atom. The general trend is that it increases across a period from left to right. However, there are exceptions due to electronic configurations.
Let's look at the elements and their configurations:
Mg (Z=12): [Ne] 3s$^2$. It has a fully filled and stable 's' orbital.
Al (Z=13): [Ne] 3s$^2$ 3p$^1$. Removing the single 3p electron results in a stable [Ne] 3s$^2$ configuration. This is relatively easy.
P (Z=15): [Ne] 3s$^2$ 3p$^3$. It has a half-filled and stable 'p' orbital.
S (Z=16): [Ne] 3s$^2$ 3p$^4$. Removing one electron results in a stable half-filled 3p$^3$ configuration. This is easier than removing an electron from P.
Comparing Mg and Al: Removing an electron from Al's 3p orbital is easier than from Mg's stable 3s$^2$ orbital. Thus, IE$_1$(Al)<IE$_1$(Mg).
Comparing P and S: Removing an electron from S's 3p$^4$ configuration is easier than from P's stable 3p$^3$ half-filled configuration. Thus, IE$_1$(S)<IE$_1$(P).
Combining these with the general trend, the overall order is:
Al<Mg<S<P.