House and Senate leaders agreed yesterday to adjourn Congress Oct. 4 but left open the possibility that the lawmakers will return after the November election.

Senate Majority Leader Robert C. Byrd (D-W.Va.) said the agreement was reached at a meeting with House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) and other leaders.

"Much remains to be done before Oct. 4," Byrd told the Senate. "I trust that we will complete our work by that time."

But, he said, "if the Congress has not completed its work . . . we will have to return later in the fall."

In addition to appropriations and authorization bills, Byrd said, Congress must consider compromise versions of bills calling for a synthetic fuels program and setting up an Energy Mobilization Board.

He said controversial Alaska lands legislation also must be considered, as well as cost-cutting measures called for by a compromise budget agreed upon by the two houses.

The House easily passed legislation authorizing $5.6 billion for the National Aeronautics and Space Administration in the upcoming fiscal year.

Passage on a 285-to-29 vote came after the House defeated 225 to 90, an attempt by Rep. Ted Weiss (D-N.Y.) to delete all research and development funding for supersonic transport aircraft.

The NASA authorization includes $1.9 billion for continued research and development of the space shuttle, which is expected to make its first orbital flight in 1981.

The senate approved a compromise on taxpaid legal aid to poor women in abortion cases, narrowly averting a ban on such help.

The compromise, written hastily in a cloakroom by Sen. Jacob Javits (R-N.Y.) during a lull in Senate debate, was approved 38 to 34.

Conservatives were pushing a ban on aid by the Legal Services Corp. to poor women in abortion litigation and proceedings.

The new antiabortion language was added to a two-year extension of the Legal Services Corp., a federally funded program that provides legal help for the poor.

Under the law that created the corporation, attorneys cannot offer help to poor women in cases involving "nontherapeutic" abortion and those violating moral convictions or religious beliefs. Senate conservatives argued that the ban is being violated.

Sen. Gordon Humphrey (R-N.H.), who proposed the ban, said, "The Legal Services Corp., like so many slippery federal agencies, has found a way around the intent of the Congress. It intends to continue that back-door approach."

Javits, faced with language more restrictive than previously adopted by Congress in dealing with the controversial abortion issue, offered his substitute to head off Humphrey.

The Javits compromise would prohibit legal aid in abortion cases where the use of federal funds for abortion is prohibited by federal law -- specifically under Medicaid and Social Security -- and in cases where religious beliefs and moral convictions are involved in the proceedings.

But it would exempt cases where abortions are needed to save a woman's life or where rape or incest occurred -- the same exceptions made in the law governing use of federal funds for abortions.

Javits said some states, under state-run Medicaid programs, have tried to go beyond federal law in banning abortions.

"I do not think we should prevent a poor woman from having a lawyer when the state is trying to take away from her a right she has under federal law," he said.

Humphrey, opposing the compromise, said, "The question is abortion -- the taking of innocent lives," and charged that the Javits proposal would "still allow Legal Services to do pretty much what it wants."