Starvation and extreme dieting can cause the gallbladder to start working or to work abnormally because it isn't exercised by the consumption of fats and/or bitter foods. The cycle of bile-digestion-absorption-cholesterol-bile is interrupted and sludge starts to form in the mucin layer of the gallbladder. The mucin layer is at the bottom and sides of the gallbladder where bile from the liver is concentrated. Mucin is heavy and combines with bile salt which is the recipe for forming stones.
Of course not every one who fast will form stones it is just another risk factor.