Magma viscosity is a measure of a magma's resistance to flow, which significantly influences volcanic eruption styles and the formation of various igneous rock types. It is primarily determined by factors such as temperature, chemical composition, and the presence of dissolved gases and crystals.