From news reports:
Several states said that such a law reduces voter fraud, but civil rights groups said it was an effort to discourage voting by legal immigrants. The case was argued and decided at a time when the country is considering how to change its immigration laws.
Citizenship is a requirement to vote in any federal election, and the federal registration form requires people to state, under penalty of perjury, that they are American citizens. States can use their own forms, but they must be equivalent to the federal form.
The Arizona law concerned federal elections, and it was struck down not because it was a "bad idea", it was struck down because there is a federal law already on the books about the subject matter. And the constitution says federal laws are "the supreme law of the land" -- the states can't trump one by passing a conflicting one.