During rapid weight loss, the body burns stored fat for energy. This process leads to an overproduction of cholesterol in the liver. The excess cholesterol is secreted into the bile, which can cause an imbalance in its chemical composition. If the gallbladder cannot empty the cholesterol-laden bile efficiently, the cholesterol can crystallize, forming gallstones.