This proverb, originally from Luke 4, verse 23, is an admonition to deal with your own shortcomings before advising others, particularly when one is telling others how to fix a problem that oneself suffers from. A good example of an instance to use this statement would be being advised to quit smoking...by a doctor who chain smokes.
Nowadays, for a physician to perform self-treatment is not considered a good idea except in minor or emergency instances. Similar things are thought of the person who serves as their own legal counsel. However, the suggestion to work on self-improvement first before criticizing others is a good one. So, before you flame someone, take a look at yourself first.
Compare: The pot calling the kettle black