It's a very solid estimate based on: the average numbers of stars in a galaxy; the number of such galaxies observed; and the size of typical sand grains.
Apparently there are approximately 70,000,000,000,000,000,000,000 stars in the Observable universe. A grain of sand, meanwhile, is typically about a millimetre across or 1mm^3 in volume, so that you would need one Billion or so grains to fill a cubic metre. This means that for the number of grains of sand on earth to match the number of stars you would need about 70,000,000,000 cubic metres of sand. If this were spread evenly over the earth then it would be about a continuous layer one metre or so thick. The earth of course is not covered all over by sand, and a lot of its surface area is bare rock, or ice, or the the like.
In fact the conclusion is that the two numbers are fairly close to each other, but on any reasonable estimates the number of stars comes out on top by a factor of about ten or so.