After months of political combat and intense White House lobbying, the Senate yesterday voted 57 to 42 for the natural gas compromise that President Carter now calls the heart of his energy program.

The measure to end price controls on newly discovered natural gas by 1985 easily survived its final Senate test after opponents had failed twice in the past week to send it back to a House-Senate conference for certain burial.

The measure now goes to the House, where supporters are increasingly optimistic it will be approved and sent to the president.

A pleased Carter said later he expects House approval and said of the Senate vote, "I think it proves to our nation and the rest of the world that we, in this government, particularly Congress, can courageously deal with an issue and one that tests our national will and ability."

If the House does pass the compromise, it would end 30 years of national debate on gas pricing.

The measure approved yesterday would immediately boost the price of natural gas from $1.50 to $2 per thousand cubic feet. It would then rise by about 10 percent a year until 1985 when controls would be lifted.

The measure also would extend controls form the interstate market to the intrastate market, which never has been under federal regulation. The president or Congress could reimpose controls for one 18-month period if prices shoot up after 1985.

Although the White House mounted an impressive campaign in support of the compromise, it bears little resemblance to the natural gas proposal in Carter's April 1977 energy message. Then he called for a continuation of price controls and an increase in the price to $1.75 per thousand cubic feet.

The House approved Carter's plan, but the Senate voted to deregulate the price of gas in two years. House-Senate conferees then spent much of this year trying to reconcile the differences. They worked out an agreement last spring, but when the final language was presented to the conferees in August, the fragile compromise nearly fell apart.

It came under fire from a coalition of liberal Democrats who thought the bill would hurt consumers, and some Republicans and representatives of gas-producing areas who said it did not move to end price controls rapidly enough. It was when this coalition threatened to scuttle the measure that the White House began its lobbying effort in earnest.

Carter met privately with key House and Senate conferees to get their approval of the measure, while Energy Secretary James R. Schlesinger, inflation chief Robert S. Strauss and Federal Reserve Board Chairman G. William Miller met with business and industrial leaders. They said that without passage of the gas bill, the already battered dollar could fall further on world markets.

The meetings had the effect Carter hoped for. Some industries that had apposed the bill, including steel, either switched positions or kept their opposition quiet. Gradually, a majority of senators made clear they would support the final version.

Under an agreement worked out by Senate leaders to avoid a filibuster, opponents were given the past week to find enough votes to send the bill back to conference. Their second and final attempt failed Tuesday, clearing the way for yesterday's vote.

Senate Majority Leader Robert C. Byrd (D-W. Va.) called the vote "a legislative milestone." But Sen. James Abourezk (D-S.D.), one of the most bitter opponents of the compromise, said it was a "lousy, stinking" bill that will cost consumers billions of dollars by 1985 without producing any more gas.

Supporters have said it will cost consumers less money in the long run than would continued controls.

When Carter sent his energy package to Congress, the natural gas measure counted for little in the fight to conserve energy. The big savers, designed to cut reliance on foreign oil by 4.5 million barrels a day in 1985, were a tax on crude oil and one on industrial users of oil and gas.

But the taxes now appear dead or this Congress and the administration has decided that deregulation of natural gas would save 1.5 million barrels of oil a day by 1985 by producing more gas.

The gas fight now moves to the House, which also has been closely divided over the years. The strategy of Speaker Thomas P. (Tip) O'Neil Jr. (D-Mass.) is to bundle all the energy bills, except taxes, into one package to put more pressure on members to support the gas bill. The Senate has approved the various pieces of Carter's plan separately.

Besides natural gas, the Senate has approved a conference-approved regulatory bill to push industry from use of oil and gas to coal. Conferees will meet today in an effort to complete action on a bill to restructure utility rates and one to conserve energy.

The House will take no action until the Senate has sent over all four bills.