Gallstones form when liquid stored in the gallbladder hardens into pieces of stone-like material.