Hens will roll and peck an egg to test its shell for strength. A farmer at the farmer's market told me they are checking the shell for its ability to provide a successful hatch. A weak shelled egg would break, killing the chick inside and threatening the entire hatch. Thus, for the hen who "tests" her eggs, it is all about providing for her reproductive success.
That's why it is good to offer hens additional calcium such as crushed oyster shell. They will still test the egg shells, but if the shell is nice and hard, they will not break it open. Also make sure boredom isn't an issue for the flock or they may "play" with the eggs to entertain themselves and eventually they will break even a hard shell.