Justices of the Supreme Court yesterday raised unexpectedly strong concerns about the legality of the U.S. hostage-release agreement with Iran.

Meeting on an emergency basis to determine whether the president is empowered to transfer billions of dollars to Iran, money claimed by more than 400 American companies, several justices questioned the government sharply about the fact that Congress was not consulted before the agreement was final.

They questioned presidential power to nullify, unilaterally, court orders that had reserved some of the money for the companies owned debts by the Iranian government, and wondered aloud whether a ruling in favor of the president might allow him to abridge fundamental rights during international crises in the future.

The justices also seemed aware that a decision against the government could have a profound future impact. Would it mean, Chief Justice Warren E. Burger asked, that a president would have a halt future negotiations to see if a proposal was "all right with the Supreme Court" or Congress?

The $4 billion is supposed to be transferred July 19 as a condition of the release of the American hostages from Iran last January. The money consists of the Iranian assets frozen in this country after the taking of the hostages. A billion is to go to an international claims settlement tribunal and the rest to Iran.

But the companies, including Dames and Moore, the California engineering firm that brought yesterday's case, had obtained court orders earlier, setting aside much of the money for repayment of debts owned them by the Iranian government.

The money is in some of America's largest banks, and they are facing the choice of violating the court orders, the attachments, by transferring the funds or violating the U.S. government's orders by refusing to transfer.

A ruling against the government could throw a wrench of undertmined consequences into the hostage agreement.

Dames and Moore lawyer C. Stephen Howard said yesterday that the president had stripped the courts of jurisdiction unilaterally by his action and had, in effect, seized private property in violation of the Fifth Amendment.

"Never before has a president, acting alone, attempted to transfer assets out of the country" when there are claims against them, he said. Had the president secured the consent of Congress, Howard said, the deal would have been legal.

But "literally read, it was as if I bought a house, say from a Canadian citizen, and the president came and deeded the house to the ayatollah" to settle a disagreement. "That just doesn't make sense," Howard said.

Rex E. Lee, making his Supreme Court debut as solicitor general designate, defended former president Carter's action. He said it is well settled, under emergency economic powers law and by tradition, that the president can settle foreign claims.

The companies have not been deprived of their money, he said, because the companies still have a chance to pursue their claims before the international tribunal.Lee said he thought the companies were better off under the agreement than they were before the hostages were taken. The companies would have had no place to go to collect debts owned them and no power to collect them, he said.

The president did not strip the courts of jurisdiction, Lee said, he simply changed the law.

"Are you saying that the president, by himself, may change the law of the land?" snapped Justice Byron R. White. He can, Lee responded, under the "implied authority" of his constitutional and emergency powers in foreign affairs.

Some of the questions were hypothetical, even jokes. "Now that he's resigned," Justice Potter Stewart could be traded away, one justice muttered.

"He'd have to pack his bags," said Iran lawyer, Thomas G. Shack Jr.

"Maybe he could send me, but he couldn't send Justice [Thurgood] Marshall," Stewart joked, in apparent reference either to constitutional protections for blacks or for sitting justices.

"What if Iran refused to replenish the tribunal's money to pay off the claims?" Burger asked Lee. Traditions of international law would require it, Lee said.

International law, said Stewart, "didn't seem to apply when it came to the seizure of the hostages, did it?"

If the president can override property rights, several justices wondered, what other rights could be traded away to get hostages back?"He can't override the Bill of Rights," said Justice William H. Rehnquist. " . . . What if an agreement promised that, for one year, no one in the U.S. would criticize the ayatollah?"

Much of the debate revolves around two laws. The companies say that the Foreign Sovereign Immunities Act divested the president of authority to settle claims and left him no authority to override it. The government says that the International Emergency Economic Powers Act, passed later, allows the president to do just that during a national emergency.

If the president doesn't have the authority, Burger asked Howard, "how can he conduct foreign affairs?"

"There are lots of things that impair the president," Howard responded. "There are lots of things that might make it easier" to negotiate. But without the approval of Congress they are illegal, he said.