Warning: spoilers ahead! Sonic shows up near the very end of the Subspace Emissary story mode, right before you face off against the final boss, Tabuu.
After that point, Sonic becomes a playable character, and you'll also unlock the Green Hill Zone stage as a bonus. It's a fitting reward for one of gaming's most iconic heroes.