Baking soda creates small carbon dioxide air bubbles in the caramel by reacting with the acid. It's what makes the caramel sauce appear foamy, and then when you caramel corn cools, the air bubbles help it maintain a soft texture.