Electromagnetic waves can travel through a vacuum because they consist of changing electric and magnetic fields, which do not require matter. Sound waves are mechanical vibrations, so they require particles to transfer the disturbance from one place to another.
This is part of IB Physics C.2 Wave model and applies to both SL and HL.
The Mechanism
Sound is a mechanical wave. In gases and liquids, it normally travels as a longitudinal wave: particles oscillate parallel to the direction of energy transfer, creating alternating compressions and rarefactions. Each particle interacts with neighbouring particles, passing the disturbance through the medium.
A vacuum contains no particles. Therefore, there can be no particle oscillations, pressure variations, compressions, or rarefactions. Sound does not merely become quieter or travel with zero speed; no sound wave can exist in a perfect vacuum.
An electromagnetic wave consists of an oscillating electric field and an oscillating magnetic field. Each changing field is associated with the other, allowing the wave to propagate through space without a material medium. In a vacuum, all electromagnetic waves travel at
