Think about balancing the positive charge of the cation and the negative charge of the anion.
You get a +3 charge from the aluminium ion, #Al^(color(red)(3+))#, and a -2 charge from the sulfate ion,#SO_4^(color(blue)(-2))#. Notice that you can use 2 aluminium ions, for a total positive charge of +6, and 3 sulfate ions, for a total negative charge of -6, and achieve neutrality.
So, you need #2Al^(color(red)(3+))# and #3SO_4^(color(blue)(2-))#, which will make your formula
The subscripts are equal to the original charges of the ions. This comes about from the cross-over rule for ionic compounds, which you can read about here: