
It means that a person is similar to the people he chooses to spend time with; he will have the same character and moral standards as those he chooses to surround himself.
The expression a man is known any the company he keeps is derived from a fable written by Aesop in the 500s B.C called The Ass and his Purchaser.