Congress, acting less than 24 hours after the start of a nationwide freight railroad strike, late last night ordered the 235,000 workers back to their jobs and imposed a settlement.

The House passed strike-ending legislation 400 to 5, and the Senate concurred quickly by voice vote. President Bush, who had left orders that he was to be awakened when the measure arrived, signed the bill at the White House early this morning.

The president is expected to issue a statement on the legislation later today.

The bill was the product of a compromise between congressional leaders and Transportation Secretary Samuel K. Skinner. He called the speed of congressional action "remarkable" and said he expected workers to be back on the job for their 7 a.m. shifts.

Union leaders' opposition to congressional intervention was effectively brushed aside by arguments that the strike over work rules would ripple into plant shutdowns in the automobile and other industries by the end of the week.

"We accept the terms and we'll work with them," said Edward Wytkind, assistant executive director of the Transportation Trades Department of the AFL-CIO. "We don't have a choice, but we do accept them."

Carol Perkins, a spokeswoman for the Association of American Railroads, said trains could be running within eight hours after the withdrawal of picket lines, which went up at 7 a.m. yesterday. Full service would be restored within 24 hours.

The legislation imposed most of a wage and benefits package suggested by a presidential emergency board set up last summer to resolve the issues, but gives unions another shot at changing or "clarifying" the emergency board's suggestions on altering work rules. A special three-person board will consider changes, and its recommendations become binding after 65 days of hearings and deliberations.

No court will review the decision. In the only avenue of appeal, the board could be called back any time until the end of the year for "loose-ends arbitration" of disputes.

Railroad spokesmen described yesterday's shutdown as orderly, and some even complimented union crews for the way they ended their runs. The unions told their members that, as is traditional, any train operating at 7 a.m., the time of the strike, should continue to its next crew change point. That meant some trains were running into yesterday afternoon.

"Our train crews have performed this shutdown in a very safe and professional manner," said Roger Campbell, a spokesman for Burlington Northern in Fort Worth.

The strike's impact on passengers was limited to commuter operations in suburban Maryland and San Francisco, and to most Amtrak long-distance passenger trains. Amtrak's busy Boston-Washington corridor continued to operate, as did some short Amtrak routes such as Los Angeles-San Diego and New York-Albany. Major commuter systems in New York, Philadelphia, Boston and Chicago operated normally.

Under the strike-ending legislation, the major issue before the new three-person board will be the troublesome one of work rules. The central question dates to the end of the steam locomotive in the 1950s: How many crew members are needed to operate a train?

Five-person crews were the norm for most of this century, but some trains now can operate with just an engineer and a conductor under some local agreements. The original emergency board recommended opening all current crew agreements to local arbitration, which the United Transportation Union said could cost it 30 percent of its membership.

Wage and benefit proposals, particularly a plan to have union members begin paying a portion of health insurance costs, were not popular. But at least two of the 11 unions agreed to those proposals, and the strike quickly concentrated on work rules.

Spokesmen for major shippers said earlier a strike of two to three days would do little harm.

However, the Big Three auto makers -- General Motors, Ford and Chrysler -- issued statements saying their operations would essentially have to shut down by the end of the week. Also affected quickly would be paper, lumber, steel, glass production, plastics and chemical industries.

The only regions not affected immediately by the strike were New England and areas along the Great Lakes. The major New England freight railroads -- Guilford Transportation and Bangor & Aroostook -- were not parties to the negotiations. Neither were a number of railroads with significant Canadian ownership, including the Grand Trunk Western in the Detroit-Chicago area and the Soo Line in the Chicago-Minneapolis area.

However, the strike shut down the core of the railroad system, the big seven: Conrail, Norfolk Southern, CSX Transportation, Union Pacific, Burlington Northern, Santa Fe and Southern Pacific. Without major connections, nonstriking railroads were limited to small amounts of local traffic.

One special-interest provision was inserted in the legislation at the last minute, allowing the board to consider wage rates and benefits on the Southern Pacific. House Energy and Commerce Committee Chairman John D. Dingell (D-Mich.) indicated on the floor that the special consideration was due to the SP's financial condition. The SP, recently taken over by the parent company of the smaller Denver & Rio Grande Western Railroad, has been struggling under its debt load and soft traffic brought on by the recession.

Clearly looking for favorable public relations, the unions offered to operate all passenger trains during the strike. However, many passenger trains shared the tracks of freight lines, which said they would not operate passenger trains for safety reasons.

A showdown over that principle occurred in Chicago where the commuter authority, Metra, obtained a court order to force the Chicago & North Western to allow union crews to run commuter trains. Its trains carry more than half of the region's commuters.

Staff writers Laurie Goodstein in New York and Edward Walsh in Chicago and special correspondent Jill Walker in Los Angeles contributed to this report.

Major railroad work rule issues that would be before a new emergency board under proposed legislation:

Crews: The emergency board recommended that the composition of train crews be negotiated locally and submitted to binding arbitration if no agreement is reached by Oct. 31, 1991. For most of this century, train crews had five people -- engineer, fireman, conductor, brakeman and flagman. Gradually, many railroads have negotiated "crew-consist" agreements for as few as two or three people, on the principle that diesel locomotives and electronic defect-detectors along the track have made some of these jobs obsolete.

Basic Day: On steam locomotives, where crews shoveled coal and worked in a more hostile environment than on today's diesels, the basic "day" was set at 100 miles for freight trains. Many steam freight trains could barely make 100 miles in a day. Over the years, the "100-mile day" became more of a system of pay than a reflection of how far a crew could go. The basic day was raised to 108 miles in earlier negotiations. The emergency board recommended raising it to 130 miles by 1995.

Contracting Out: Sending work traditionally performed by railroad craft unions to non-railroad shops has become a major issue. The emergency board recommended that regional arbitration panels be set up to settle disputes.