The hard facts: (a) The acceleration of gravity on Earth is g ~ 9.8 m/s2; (b) π2 ~ 9.87.
The question: Is that pure chance?
The naive answer: Sure. Just change the units, the similarity is gone. Just change the planet, the similarity is gone.
Yet… a little bit of historical research tells us that it is not pure chance. How come?
Of course, if there is a connection between the two values, it must be historical, not physical. The similarity between the two values is just on Earth, and with our units. But how is the meter defined? The definition has evolved with time (and in the US they still use units related to the lengths of their extremities… ains…). For a long time, it was one ten-millionth of the length of the Earth’s meridian. So the relation to the Earth is ensured in the definition, no doubt.
No magic involved, just history. It was the French National Assembly, during the Revolution, defining the meter. They wanted a universal definition, and they came up with that one. But it was not the first one… Before, there were others.
As far as we know, it was the marvellous mind of John Wilkins the first to conceive the idea of meter. And what was his definition? No wonder, the length of a seconds pendulum. That means: a pendulum whose period is two seconds. Now, for a bit of physics, remember that, within the small angles approximation, the period of a pendulum is
Now, imagine that we were using Wilkins’ meter. Then with a pendulum of length 1 length-units, we would have a period 2 time-units. Just solve for g and… hey! You get… π2.
Wilkins’ idea went all the way down to Huygens, and to Talleyrand, who proposed it to the French revolutionaries. Technical difficulties, mostly the fluctuations of length with temperature, made them change the choice, but nonetheless picking up a close value.