Many birds swallow sharp pebbles and grit and hold these rocks in a muscular part of their stomachs called the gizzard. The gizzard contracts and grinds the gastroliths against each other and against the food that the bird has swallowed (remember that birds have to swallow each bite whole). The rocks grind down the food — essentially, the bird is using the gastroliths to chew the food in its gizzard — and the rocks grind each other down, too. Eventually the sharp, jagged chunks of rock become smooth, rounded pebbles, and they are not much good for grinding anymore. So the bird will vomit them out and find new, sharp rocks to swallow.

More Info: ucmp.berkeley.edu