The Supreme Court ruled yesterday that the federal and state governments have no legal obligation to help poor women pay for most abortions.

The 5-to-4 decision, upholding the constitutionality of the federal Hyde amendment and similar state laws restricting abortion funding, is expected to lead to fund cutoffs in 40 states, most of which had been financing abortions under contested court orders. The District of Columbia and nine states, including Maryland, had chosen to finance Medicaid abortions with their own funds and will be free to continue to do so. One state, Arizona, has no Medicaid program.

The ruling, a total victory for antiabortion forces, headed off a major constitutional confrontation between Congress and the courts. But it refueled the ever-present political issue of abortion by returning the funding decision to Congress and each state legislature in an election year.

The court set off the controversy in 1973 by ruling that no woman could be denied a legal abortion.

That ruling, the court said yesterday, did not also mean that government had to pay for abortions. The freedom to have an abortion, like the freedom to use contraceptives or attend private schools, is not accompanied by a grant of money in the California, Justice Potter Stewart wrote for the majority. State and federal legislators may restrict the money to advance the "legitimate government objective of protecting potential life," his opinion said.

Chief Justice Warren E. Burger and Justices Byron R. White, Lewis F. Powell Jr. and William H. Rehnquist joined Stewart. Justices Harry A. Blackmun, John Paul Stevens, William J. Brennan Jr. and Thurgood Marshall issued strong dissents.

The consequence of yesterday's decision, Marshall wrote bitterly, "is a devastating impact on the lives and health of poor women." He speculated that a hundred women will die each year as a result of the Hyde amendment and that countless others will have unwanted babies. "I do not believe that a Constitution committed to the equal protection of the laws can tolerate this result," Marshall wrote.

The Hyde amendment, named for is sponsor, Rep. Henry J. Hyde (R-ILL.), has been in force in varying forms since 1977. It denies federal funds under Medicaid -- the health program for the poor -- for all abortions except those necessary to save the mother's life or in cases involving rape or incest. Its enactment, as a rider to the annual health appropriations bill, represented a fallback maneuver for antiabortion forces frustrated by the court's 1973 ruling legalizing abortion.

Though Hyde left the states free to pay for abortions from their own funds, only 9 states, including populous New York, and the District did so until a series of federal court rulings held the federal and similar state abortion funding restrictions unconstitutional. The court considered two of these rulings, one by U. S. District Court Judge John Grady in Chicago and the other by John Dooling in New York.

The rulings, Stewart wrote, exceeded the authority of the courts. "It is not the mission of this court or any other to decide whether the balance of competing interests reflected in the Hyde amendment is wise social policy. If that were our mission, not every justice who has subscribed to the judgement of the court today could have done so."

Proabortion activists and the lower court judges argued that the Hyde amendment actually prevented abortions for poor women in violation of the 1973 ruling and thus discriminated against a whole class, for among other things, religious reasons.

Stewart said he found the arguments inadequate on the following grounds:

The Hyde amendment does not deny abortions, he said: "it does no governmental obstacle in the path of a woman who chooses to terminate her pregnancy" and it "leaves an indigent woman with at least the same range of choice in deciding whether to obtain a medically necessary abortion as she would have had if Congress had chosen to subsidize no health care costs at all." The fact that Congress did subsidize some services, Stewart wrote, does not require it to subsidize all.

The majority also said Hyde does not single out for discriminatory actions a "suspect class," such as blacks or other minorities. Its principal impact is on poor people, Stewart wrote, but the court has always held that "poor people" are not a class specifically protected in the Constitution.

Pregnant teen-agers who are poor also are not, as a class, specifically protected by the Constitution, as Judge Dooling had ruled.

Even if a class were being singled out, Stewart said, using the same reasoning used to defend "reverse discrimination," that could be constitutional if it is "rationally related to a legitimate government objective . . . By the Hyde amendment, Congress has established incentives that make childbirth a more attractive alternative than abortion for persons eligible for Medicaid.These incentives bear a direct relationship to the legitimate congressional interest in protecting potential life."

Stewart also said the Hyde amendment does not, as Dooling ruled, impose on everyone the religious beliefs of Catholics and adherents of other faiths opposed to abortion. "That the Judeo-Christian religions oppose stealing," Stewart wrote, "does not means that a state or the federal government may not enact laws prohibiting larceny. . . ."

"Hyde amendment," Stewart wrote, "is as much a reflection of traditionalist values toward abortion as it is an embodiment of the views of any particular religion."

Stewart wrote that because abortion choice is guaranteed "it simply does not follow that a woman's freedom of choice carries with it a constitutional entitlement to the financial resources to avail herself of the full range of protected choices.

"Although government may not place obstacles in the path of a woman's exercise of her freedom of choice, it need not remove those [obstacles] not of its own creation.

"Indigency falls in the latter category. . . . We are thus not persuaded that the Hyde amendment impinges on the constitutionally protected freedom of choice" recognized by the court in its 1973 abortion opinion.

The court also said that states need not provide money for abortions to conform to the Social Security Act's Medicaid provisions. Medicaid was designed to be a cooperative effort in which the state matched federal funds, to protect the health of poor people.

It "did not intend a participating state to assume a unilateral funding obligation for any health service. If Congress chooses to withdraw federal funding for a particular service, a state is not obliged to continue to pay for that service as a condition of continued federal financial support for other services."

In their dissents, Stevens, Marshall, Brennan and Blackmum, who wrote the original abortion decision, attacked both the reasoning and result of the majority's ruling.

Brennan, writing for Marshall and Blackmun in a combined dissent, said that the denial of abortion funding for medically necessary abortions "plainly intrudes upon this constitutionally protected" freedom of choice. "For both by design and in effect, it serves to coerce indigent pregnant women to bear children that they would otherwise elect not to have."

Marshall and Blackmun also wrote a separate dissent, as did Stevens.

The ruling does not save money for taxpayers, because Medicaid pays for medical care during pregnancy and childbirth for women who might have received abortions. A childbirth is generally eight to 10 times more expensive than an abortion.

The court ruled in 1977 that states have no obligations to finance "elective" or not medically necessary -- abortions.

Yesterday's cases involved abortions believed necessary for the health of the women. Dooling's ruling had defined that necessity to include even psychological stress resulting from an unwanted birth.

Because the Hyde amendment does not deny fund for abortions to save a woman from probable death, the court did not address the legality of this. Some observers, however, believed its holding is broad enough to allow such a denial.