Our elders observed over long periods that rarely do two people of the same qualities end up together. It may be nature’s way of securing a balance, but it seems rare for people of the same character to get married. Hence this is not seen as a mismatch but rather as the norm, with few exceptions. Invariably it means that people are attracted to those with different qualities to their own.
The proverb is used in observation of people of opposite traits or habits being matched together. It is an explanation as well as a resignation to the fact that one person of high standing or standards happens to be with or attracted to someone who is clearly their opposite.