This is an excellent question. Let me make three points that will help you see the connection between conformity and discrimination.
First, all societies have a commonsense view of the world. In other words, all societies have a sense of what is right and wrong. This cultural idiom is powerful and causes people to fall in line, that is, to conform. Hence, conformity is being in line with the prevailing worldview of a society.
Second, those in power usually create the worldview and spin the ideology. In this way, there is a expected way each group should operate.
Third, when a person does not conform, then there is conflict. If a person acts in line, then society can move on. When the person does not conform, then there can be discrimination in many forms. It could be mild, where the society ostracizes the person who does not conform, or it could be more severe, where there is persecution.
In short, the lack of conformity is the beginning of discrimination.