The Supreme Court case that set out this rule is the case of Reynolds v. Sims, which was decided in 1964. This ruling set out the rule that all legislative districts in a state had to have roughly the same number of people in them.
Before this ruling, state legislative districts often favored rural areas over urban ones. In many cases, they were drawn along county lines. They might have been drawn, for example, when the counties all had relatively similar populations and were then never redrawn. As the population shifted from rural areas to the cities, the rural areas came to have many fewer voters than the urban areas even as they had the same number of representatives in the legislature.
In Reynolds, the Supreme Court held that this situation was unconstitutional. It held that it violated the 14th Amendment. This led to redistricting in which states had to equalize the numbers of voters in the various legislative districts.