The answer I have been given is that prior to tombstones (in today's
sense of the term) being commonplace the grave was simply covered with
stones. Stones would fall away from the grave as a result of wind and
rain. Therefore a common courtesy was to replace stones on the grave
when visiting.
Another minhag with a very practical origin.