The supports around the fire place must be checked. The foundation must be checked for structural stability. Removal may be neccessary. Reconstruction may be the repair needed.
Fireplaces that are leaning can be a real pain. First off, if it is leaning, something is wrong with the foundation most likely. Short of tearing it down to the point of being level and rebuilding it, there is very little to be done.
Fire places are very dangerous if they are not constructed correctly. If it is leaning I would suggest tearing it down and doing a rebuild. Any contractor that attempts to fix it is crazy. You need to tear it down before it falls on someone/something or if your using it could catch your houseo n fire.
I think this is best left to a professional. If you dont have it fixed properly there could be a fire or other health risk. If you contact a home inspection company they could give you names of a qualified professional.