The Supreme Court handed a surprise victory to civil liberties groups yesterday by abolishing absolute immunity from damage suits for municipalities whose official policies or customs may deprive citizens of constitutional rights.

The 7-to-2 decision extends a 1961 ruling with which the court, for the first time, permitted citizens to seek personal damages from police officers and other city and county employes who were authorized to, and did, abuse basic rights.

The earlier ruling - the source of a flood of civil rights litigation for 17 years - completely insulated the municipal corporations for which such employes worked. That insulation was stripped away yesterday.

The new decision was unexpected - even in the Justice Department - because in agreeing in January 1977 to review the case at issue, the court gave no hint that it would reconsider its 1961 decision. The case involved compulsory maternity leaves for employes of the New York Board of Education.

Moreover, the partial reversal of the 1961 decision was announced by Justice William J. Brennan Jr. and joined by Justice Potter Stewart, both of whom were in the majority in 1961.

In the opinion for the court, Brennan attributed the reversal largely to "a fresh analysis" of the debate in Congress that led to adoption of the Civil Rights Act of 1871.

Another factor was an inconsistency: in a score of cases, the court has held school boards liable in rights cases brought under the Reconstruction-era law, even though, Brennan said, the reasoning in the 1961 decision does not allow a distinction to be drawn between school boards and municipalities.

Brennan emphasized under yesterday's decision, municipalities retain immunity from numerous types of suits, particularly those arising from an injury caused by an employe who is not carrying out official policy.

In the dissenting opinion, Justice William H. Rehnquist, joined by Chief Justice Warren E. Burger, said that the majority provided adequate justification for ending the immunity that "has protected municipalities and their limited treasuries from the consequences of their officials' failure to predict the course of this court's constitutional jurisprudence," Rehnquist added.

"None of the members of this court can foresee the practical consequences of today's removal of that protection. Only the Congress . . . is such a drastic change in the law. It seems all but inevitable that it will find it necessary to do so after today's decision.

In New York City, the American Civil Liberties Union termed the decision "one of the most important . . . of the past five years." Commenting on the dissent, ACLU legal director Bruce J. Ennis said that "municipalities which obey the law and do not violate constitutional rights will not have to pay money damages."

The decision may foreshadow a swift defeat for the City of Pittsburg, which has asked the court to reverse a ruling that it can be sued by two black brothers who were stopped by two white policemen for alleged traffic violations. A violent dispute, arrests and convictions followed.

The 3rd U.S. Circuit Court of Appeals ruled that the brothers could sue because their complaint was "based not on private acts of violence, but instead on officialmisconduct under color of state law by the city's police officers."

In a similar ruling Monday, the 2nd U.S. Circuit Court of Appeals ruled 5 to 4 that West Haven, Conn., could be sued by a teen-ager who claimed that local police wrongfully arrested him and thereby violated his civil rights. He seeks $200,000 in damages, half of them punitive. The dissenters said that, if upheld, the legal theory adopted by the majority could imperil the financial stability of numerous communities.

Yesterday's decision came less than 10 weeks after the court ruled, 5 to 4, that a city may be liable for damages if it engages in anticompetitive activities without authorization by a state legislature.

The decision involved Jane Monell and other women who, in a class action begun in 1971, complained that their civil rights were violated by a citywide policy of compelling pregnant municipal employes to take unpaid leaves before medical considerations necessitated such leaves. They sought back pay from the school board and various officials.

The suit invoked section 1983 of the 1871 law, which authorized a citizen to sue "any person who, under color of any law . . . regulation, custom, or usage of any state," shall cause a deprivation of a right guaranteed by the Constitution.

The 2nd Circuit ruled, that the board was immunized because it is not a "person" and the officials because the city, immunized by the 1961 Supreme Court decision, would have to pay damages awarded against them. That was all that the Supreme Court agreed to review.

The bulk of Justice Brennan's 44-page opinion is the "fresh analysis" of the legislative history of the 1871 law. It compels the conclusion that Congress "did intend" to apply section 1983 to local governments, he wrote, Agreeing, Justice Lewis F. Powell Jr. noted that the issue never before had been briefed or argued in the court.

Brennan termed it "simply beyond doubt" that if Congress viewed local governments as not liable under section 1983, it would have viewed as exempt state officials although "everyone . . . knew 1983 would be applied to state officers . . ."

Municipalities =simply cannot 'arrange their affairs' on an assumption that they can violate constitutional rights indefinitely," he said.

Relinquist objected that in abandoning a "long and consistent line of precedents," the court was offering "injustification only an elaborate canvass of the same legislative history which was before the court in 1961."