It stores bile liquid, which contains digestive enzymes.
When the pyloric valve of the stomach opens, the gallbladder simultaneously contracts, mixing bile with the liquefied food. Since stomach juices are highly acidic, bile also contains basic ions and buffers to neutralize the acid and protect the intestines. Bile also acts as a dispersing agent, helping to digest and emulsify fats, and to break up clumps of small particles.
Bile is produced by the liver and travels down the common bile duct into the gallbladder for storage. Sometimes, if the gallbladder gets infected, inflamed, or blocked, it must be removed. Sometimes "gall stones" may form. The body seems to adjust reasonably well without a gallbladder, as the liver naturally produces more bile whenever food is eaten.