Magnetic fields have two properties important for us. First, they can act like a magnetic bottle, holding hot gas between the field lines. But it is not a rigid bottle, so that hot gas can squirt out like catsup out of a plastic catsup bottle, or even like champagne out of a shaken-up champagne bottle. When the magnetic fields get twisted around, so that magnetic fields of opposite direction encounter each other, they can reconnect , and the energy from that reconnection can go into heating the gas hotter. So the answer seems to be that magnetic fields are responsible, through reconnection and squirting, for heating the gas and getting it up into in the corona and beyond.
Solar flares are the manifestation of the coronal heating.
A solar flare is a violent outburst on the surface of the sun that can release energy up to 10 billion megatons of TNT and may be the direct result of reconnection. Because magnetic fields hold the hot gas as in a bottle, they are ultimately responsible for the shapes of the features we see on the sun, as shown in the slides. Coronal mass ejections are really giant flares that expel a large amount of gas with high velocity out of the sun. That gas can actually hit earth and can cause satellite disruptions. That gas is responsible for the auroras .