According to WebMD, the gallbladder is a small pouch situated behind the liver that stores bile for use in digestion. The gallbladder's primary purpose is the storage and secretion of bile.
According to Wikipedia, bile is produced by the liver and delivered to the gallbladder. During digestion, food kept in the acidic environment of the stomach moves into the duodenum, and from there to the small intestine, where the next stage of nutrient extraction begins. As food moves from the stomach into the duodenum, the gallbladder secretes bile through the common bile duct into the small intestine.
Enzymes from the pancreas do not function well in an acidic environment, so the food is mixed with bile to alter its pH. By conserving the surplus bile produced by the liver, the gallbladder ensures that a steady supply of it is available to process food as it becomes available.
Occasionally, the gallbladder develops an obstruction called a gallstone. Gallstones are made from cholesterol, and their presence in the bile duct can be extremely painful, notes Wikipedia. When this occurs, the gallbladder may be removed without noticeable adverse effects on the way the body digests food.