The exact quote is "Don't be so heavenly minded that you are of no earthly good", and it was made by an infamous person. Scholars believe that it was derived from the Biblical quote; 'Set your mind on things above, not on the things that are on earth'. This quote is from Colossians chapter 3 verse 2.
I'm hoping you don't mind that I am adding this. Janemoo gave an excellent answer to your question, and I just wanted to mention this along with it. I used to think about this quote myself and still do on occasion. For me, I pondered, just what this quote meant pertaining to our daily life. I decided that I think it means that we can think on things if we aren't careful, in much the same way as the pharisees did. We do need to be careful. The thing is if I love God with all my heart and all I am, then I will also love my neighbor as myself for God is Love and He will change my heart and I will automatically be more like Him and feel as He does, think in much the same way as He does. This is a "heart change" from the point of salvation on throughout my life. But, if I lose sight of Jesus and just focus on rules and such in such a way as to forget Christ and who He is,...it will be like this, I will forget where God brought me from and the mercy He has shown me and I will not be able to be touched with the feelings of other's pains and shortcomings, I will be no earthly good. God saw it important enough to send His Son, Jesus to earth, and yet, I reside here and will be useless.