The court argued that it did not. From wikipedia:
. . . the position of chaplain has been closely tied to the work of state and federal legislatures. "This unique history leads us to accept the interpretation of the First Amendment draftsmen who saw no real threat to the Establishment Clause arising from a practice of prayer similar to that now challenged."
And from Oyez Project:
In a 6-to-3 decision, the Court upheld the chaplaincy practice. In his opinion for the Court, Chief Justice Warren Burger abandoned the three-part test of Lemon v. Kurtzman, which had been the touchstone for cases involving the Establishment Clause. In its place, Burger rested the Court's opinion on historical custom. Prayers by tax-supported legislative chaplains could be traced to the First Continental Congress and to the First Congress that framed the Bill of Rights. As a consequence, the chaplaincy practice had become "part of the fabric of our society." In such circumstances, an invocation for Divine guidance is not an establishment of religion. "It is," wrote Burger, "simply a tolerable acknowledgment of beliefs widely held among the people of this country."
From the dissent:
The Court makes no pretense of subjecting Nebraska's practice of legislative prayer to any of the formal "tests" that have traditionally structured our inquiry under the Establishment Clause. That it fails to do so is, in a sense, a good thing, for it simply confirms that the Court is carving out an exception to the Establishment Clause, rather than reshaping Establishment Clause doctrine to accommodate legislative prayer. For my purposes, however, I must begin by demonstrating what should be obvious: that, if the Court were to judge legislative prayer through the unsentimental eye of our settled doctrine, it would have to strike it down as a clear violation of the Establishment Clause.
The majority in other words was making an exception for legislative prayer in a manner that it did not for other similar cases.