The primary function of the mitochondrial inner membrane is to generate a proton gradient through the process of oxidative phosphorylation, where electrons are passed through a series of electron transport chains, pumping protons across the membrane and creating a concentration gradient that drives ATP synthesis. This gradient is crucial for the production of ATP. The inner membrane's unique structure, with its infoldings and cristae, increases its surface area to enhance this process.