This may be caused by a variety of fungal or bacterial infections, and is more likely when plants are under stress due to excessive moisture or high temperatures combined with high humidity.
Spots are more likely to appear on older leaves. Some aloes have a genetic susceptibility, and often a few spots is unavoidable. This is no cause for concern as it does not affect the plant’s health or flowering. If the spots are really unsightly (e.g. covering more than 10% of the leaf surface) spraying with fungicide may clean up the new growth.