Magnesium sulfate works as a desiccant by forming hydrates. When exposed to water, it binds with water molecules to form various hydrated forms, such as MgSO4ยท7H2O. This property allows it to remove moisture efficiently from reaction environments, thus improving the efficiency and selectivity of catalytic reactions.