The proverb's meaning is that just as fish prefer muddy waters and avoid clear streams, people generally do not associate with those who are too ideal in terms of ethics, manners, and habits. In other words, being strictly honest and always making the right choice from the standpoint of society-imposed values will result in you being isolated and having no friends.
I will now elaborate to better explain the idea. The idea is that there are some good reasons to keep very upright people at arm's length:
If someone is too strict towards himself or herself, he or she is likely to judge others by his or her high standards, which may lead him or her to make big deals out of minor matters, criticize others, report them, and refuse to forgive even small accidental wrongdoings. In contrast, those who are not ideal have no difficulties accepting that others are not, too.
Very upright people are hard to cooperate with on matters where ethical flexibility is required. The ability to cooperate on such matters is important because problems sometimes arise whose only practical solution is to bend rules.
Brutally honest people tend to create awkward and problematic situations by being too direct and honest. Friedrich Nietzsche said about it, "If you want to offend somebody, just tell him the truth."
Strict people often lack common sense and human understanding on the emotional level and, as a result, tend to take decisions based on abstract logical considerations. This can sometimes lead to awful practical outcomes because of a failure to take the feelings of others into account and see all circumstances and nuances of a situation.
Since there is no reason to be honest and upright just for the sake of being honest and upright, those who are always blindly honest and upright are likely to be close-minded, dogmatic people in the broad sense.
Intuitively led by the above reasons, many avoid associating with people who are too ideal from the standpoint of society-imposed values, and this is what the proverb is about.
I am curious how this idea is commonly or idiomatically expressed in German. In particular, a German acquaintance of mine told me he had found a banknote on a street in Germany and had brought it to local police, and I am curious how I can idiomatically tell him in his own language that what he did is not something to brag about.