Gallstones can block the tubes that carry digestive fluids from the gallbladder or pancreas to the small intestine. This can lead to swelling and infection in these ducts or organs.