The decision is U.S. v. Torres (handed down yesterday). The court doesn't decide whether "the people" in the Second Amendment includes illegal aliens, but does conclude that illegal aliens are at least outside "the core" of the Second Amendment right:

"[D.C. v. Heller] tells us that the core of the Second Amendment is 'the right of law-abiding, responsible citizens to use arms in defense of hearth and home.'" ... [Title 18] § 922(g)(5) does not burden this core right, because the prohibition applies only to those who are present in the United States "illegally or unlawfully."

Because of this, the court evaluated the ban on gun possession by illegal aliens under only "intermediate scrutiny," rather than "strict scrutiny." In practice, intermediate scrutiny has sometimes been read as quite demanding of the government (almost as demanding as strict scrutiny), for instance as to sex discrimination or commercial speech restrictions. But in other areas, it has often ended up being much less demanding, for instance as to restrictions that incidentally burden symbolic expression, as to content-neutral speech restrictions (at least in many cases), and as to restrictions on gun possession. And here, the Ninth Circuit concluded that the law satisfied this standard, chiefly because it saw gun ownership by illegal aliens as particularly dangerous:

"[T]hose who show a willingness to defy our law are ... a group that ought not be armed when authorities seek them." If armed, unlawful aliens could pose a threat to immigration officers or other law enforcement who attempt to apprehend and remove them.

Further, "[unlawful aliens] often live 'largely outside the formal system of registration, employment, and identification, [and] are harder to trace and more likely to assume a false identity.'" Therefore, "the ban on the possession of firearms by [unlawful aliens] is substantially related to the statute's general objectives because such persons are able purposefully to evade detection by law enforcement."

Finally, "the government has a[] strong interest in preventing people who already have disrespected the law (including, in addition to aliens unlawfully in the country, felons, § 922(g)(1), fugitives, § 922(g)(2), and those convicted of misdemeanor crimes of domestic violence, § 922(g)(9)) from possessing guns." Section 922(g)(5) and other concurrent additions to § 922(g) "reflect[] Congress's judgment that persons within these categories 'may not be trusted to possess a firearm without becoming a threat to society.'"

I have come to be quite skeptical of the "tiers of scrutiny" approach that courts have been using in various constitutional cases, such as strict scrutiny and intermediate scrutiny; I think those labels, and the verbal formulae used to define them, e.g., "narrowly tailored to a compelling government interest" (strict scrutiny) or "substantially related to an important government interest" (intermediate scrutiny), usually conceal more than they reveal (see, e.g., this article criticizing strict scrutiny in free speech cases. Intermediate scrutiny strikes me as especially indeterminate. But the Supreme Court has generally mandated this approach in many substantive rights case (e.g., under the First Amendment, the Equal Protection Clause, and substantive due process), so it's unsurprising that lower courts have picked it up as to the Second Amendment.