means that
close association with dishonest or troublesome people may expose someone to their bad influence or the consequences of their conduct.
When one should be careful of the company one keeps; if a person spendw time with bad people, he will suffer the consequences, the saying “If you lie down with dogs, you will get up with fleas” is appropriate.