Magnesium reduces the volume of the gallbladder, which helps reduce the gallstones pain. It also relaxes the Oddi's sphincter, which will release bile from ducts to the gut,  assisting in relieving pain (8, 12).