The announcements, first by Mr. McCain, then by Mr. McConnell, dealt another setback to the effort to repeal the Affordable Care Act, which once seemed inevitable after years of promises by congressional Republican leaders that they would dismantle it.
With control of the White House and both houses of Congress, Republican leaders foresaw a quick strike coming as soon as January or February. But the House struggled to pass its version of the bill, and the Senate has had even more troubles. Mr. McConnell had to postpone the first votes before the July 4 recess when it was clear he did not have enough support for a procedural motion to take up the bill.
A revised measure unveiled last week was supposed to win over more Republicans, but it was greeted quickly with two Republican defections: Senators Susan Collins of Maine, a moderate, and Rand Paul of Kentucky, a conservative. Both have said they oppose the bill in its current form, for very different reasons, and will not vote even to begin debate.
That left Mr. McConnell without a vote to spare. Mr. McCain’s ailment cost him the final vote — at least for now.
Mr. McCain’s absence will give the forces of opposition — which include scores of health care provider organizations and patient advocacy groups — more time to mobilize.
On Friday, in a joint letter, the insurance industry lobby and the association that represents Blue Cross Blue Shield plans came out strongly against one of the innovations in the latest draft. They joined consumer groups, patient advocates and organizations representing doctors, hospitals, drug abuse treatment centers and religious leaders who have expressed opposition to the bill.
With Mr. McCain missing, Senate Republicans would have only 49 potential votes to move ahead with the legislation because all Senate Democrats and the two independent senators oppose it.
Mr. McCain, 80, announced Saturday night that he had the surgery at Mayo Clinic Hospital in Phoenix. He is at home with his family and, “on the advice of his doctors,” will be recovering in Arizona this week, a spokeswoman said.
Mr. McConnell said that “while John is recovering, the Senate will continue our work on legislative items and nominations.”
But congressional aides, lobbyists and state officials said Saturday night that Senate leaders should rethink their strategy after being forced to postpone consideration of the repeal bill, which opinion polls show to be highly unpopular.
The House passed a repeal bill, broadly similar to the Senate measure, by a vote of 217 to 213 in early May. Mr. McConnell has had a more difficult time rounding up support in the Senate.
Mr. McCain has been decidedly noncommittal in his comments on the bill. Asked last month about the chances for a quick agreement among Republican senators on a bill, he said that “pigs could fly.”
A number of other Republicans have expressed serious reservations about the bill in its current form. They include Senators Shelley Moore Capito of West Virginia, Dean Heller of Nevada, Lisa Murkowski of Alaska and Rob Portman of Ohio.
Governors from both parties have sharply criticized the Senate bill, drafted mainly by Mr. McConnell. Trump administration officials are frantically trying to win over state officials gathered in Providence, R.I., this weekend for a meeting of the National Governors Association.
The administration is trying to discredit estimates by the Congressional Budget Office that more than 20 million people would lose insurance coverage by 2026 as a result of the Senate and House bills.
When Senate Republican leaders unveiled a revised version of their health care bill on Thursday, Mr. McCain said it did not include the measures he had been seeking to protect the people of Arizona and newly eligible Medicaid beneficiaries, in particular.
Tens of thousands of people in Arizona have gained coverage through the expansion of Medicaid under the Affordable Care Act, and Mr. McCain was planning to propose amendments to the bill to protect his constituents.
In all, 20 Republican senators come from states that have expanded Medicaid.
Mr. McCain also criticized the unusual process by which the bill was developed: in the majority leader’s office, without the benefit of public hearings or the expertise of Senate committees.
“Have no doubt,” Mr. McCain said in a statement. “Congress must replace Obamacare, which has hit Arizonans with some of the highest premium increases in the nation and left 14 of Arizona’s 15 counties with only one provider option on the exchanges this year.”
“But if we are not able to reach a consensus,” he continued, “the Senate should return to regular order, hold hearings and receive input from senators of both parties, and produce a bill that finally provides Americans with access to affordable and quality health care.”