From Sonic Retro
It had been deactivated for a long time. In order to reactivate the cannon, the seven Chaos Emeralds were needed. When six of the Emeralds were found, Eggman demonstrated its power, blowing up half of the moon.
They needed the last emerald to fully power the machine, and Tails had it. When Sonic and the others landed on ARK, Eggman kidnapped Amy, and told Sonic to give him the emerald for her safety. Sonic planned on using Tails' special fake emerald, but Eggman was too smart.
He trapped Sonic in a capsule, and blasted him down to Earth. After he fought Tails, he stole the real emerald and put it into the Eclipse Cannon, but it wouldn't fire. Professor Gerald had prepared for that, and the emeralds power overcharged the cannon and sent ARK hurtling to Earth.
Inside the core, while Shadow fought the Biolizard, Knuckles stopped the emeralds' power with the Master Emerald. Unfortunately, the Biolizard vanished and attached to the cannon's point, becoming Finalhazard. After the reptile's defeat by Super Sonic and Super Shadow, the two of them used Chaos Control to teleport ARK away from Earth's atmosphere, saving the world from disaster.
In Shadow the Hedgehog, two scenarios involving the cannon occur. If Shadow helps Black Doom in The Ark level, the Eclipse Cannon will be fired at Earth, destroying Central City in an Independence Day-esque fashion. However, after defeating Devil Doom in the Last Story, Shadow uses the Eclipse Cannon to destroy the Black Comet and the Black Arms once and for all.