According to Rawls, social and economic inequalities are to be arranged so that they are to everyone's advantage and attached to positions open to all. He argues for this by arguing against the prevailing ideology of equal opportunity.
Inequalities are just only when conditions of equal opportunity obtain.
Conditions of equal opportunity obtain only when a person's fate is not determined by morally irrelevant factors. One's fate is not determined by morally irrelevant factors only when it is determined by one's choices and efforts. One's fate is determined by one's choices and efforts only if it is not determined by social circumstances. Therefore, inequalities are just only when not determined by social circumstances. Rawls argues that the prevailing ideology is unstable, since it only rules out inequalities determined by social circumstances.