Whatever the activity, the majority of exercises are performed with the feet in contact with the ground, which is sometimes abrasive, or with a surface to which you will apply your foot (step aerobics, cycling, trampolining, etc.).
Using shoes helps to reduce friction between the foot and these surfaces.