They knew each other as children. Silver is shown coming to Blaze's defence when other kids picked on her — which is generally put down to her pyrokinesis. A child who can conjure fire is an easy target for cruelty, and having someone willing to stand up for you is how a lasting partnership starts.
That shared history is what makes their teamwork in Sonic the Hedgehog (2006) feel earned rather than convenient: they are not new allies, they are old friends.