President Biden said Sunday that his administration may extend an Aug. 31 deadline for withdrawing troops from Afghanistan, as the Pentagon enlisted the help of U.S. airlines to evacuate Americans and Afghan partners from the country.

“There’s discussions going on among us and the military about extending” the deadline, Mr. Biden told reporters at the White House. “Our hope is that we will not have to extend. But there are going to be discussions I expect about how far along we are in the process.”

The president spoke as U.S. airlines were positioning aircraft to comply with a Pentagon order, announced Sunday morning under a rarely invoked law, that compelled six airlines to contribute 18 planes to help with the evacuation. Officials said the commercial aircraft wouldn’t fly in and out of Kabul, the Afghan capital, but would ferry evacuees to the U.S. from bases in Germany, Qatar and Bahrain to ease transport bottlenecks.

The first flights carrying evacuees were expected Monday.

People gathered near a gate at the Kabul airport on Sunday.

Photo: Rahmatullah Alizadah/Xinhua/Zuma Press

The escalated activity came as thousands attempted to penetrate the Kabul airport in an effort to flee, fearing retribution from the Taliban, which seized the capital a week ago. Mr. Biden and U.S. officials also warned that Islamic State terrorists posed a threat to Americans in Afghanistan, and that U.S. officials were working to stop potential attacks and defend the airport.

The airlift is entering a critical phase, ramping up after days of mayhem at Kabul airport that stunned the world and dealt a serious blow to the Biden administration, which had predicted an orderly withdrawal only to see the Taliban seize Afghanistan’s capital in days. U.S. forces have strained to protect the airport and increase the number of departing flights ahead of Mr. Biden’s Aug. 31 deadline for the U.S. to exit from the country.

Mr. Biden had raised the possibility last week that troops could remain in Kabul past Aug. 31 if necessary to make sure Americans and Afghans who worked for the U.S. over the past two decades aren’t abandoned.

Mr. Biden said the U.S. had evacuated nearly 28,000 people since Aug. 14, on military and other aircraft, bringing the total number of evacuees since July to 33,000. He said that 23 U.S. military flights had carried 3,900 people from Kabul within a recent 24-hour period and said, “We see no reason why this tempo will not be kept up.”

President Biden acknowledged the difficulty of getting thousands out of Afghanistan during a news conference Sunday. Photo: ANDREW CABALLERO-REYNOLDS/AGENCE FRANCE-PRESSE/GETTY IMAGES The Wall Street Journal Interactive Edition

The Pentagon’s orders to the commercial airlines marked only the third time in 70 years that such a step has been taken. The Pentagon requested aircraft from six airlines for a period of approximately one to two weeks, defense officials said.

American Airlines Group Inc., Atlas Air Worldwide Holdings Inc., Delta Air Lines Inc. and the Omni Air unit of Air Transport Services Group Inc. are providing three aircraft each, while two planes will come from Hawaiian Holdings Inc. and an additional four from United Airlines Holdings Inc.

The U.S. military has deployed dozens of C-17 cargo aircraft to fly evacuees out of Kabul. Some flights have transported more than 400 people, packed tightly on the floors of planes designed to carry cargo. Those planes, which lack adequate restroom facilities or the ability to provide food, aren’t suited to carry civilians for the long trip over the Atlantic to U.S. bases, where the Afghans will be taken, officials said.

The Civil Reserve Air Fleet, or CRAF, created after the post-World War II Berlin Airlift, is authorized under the Defense Production Act, which the government has used to compel companies to produce goods and provide services on an urgent basis. The Civil Reserve Air Fleet has been used only twice before, the Pentagon said, during U.S. military operations in Kuwait in 1990 to 1991 and the start of the war in Iraq in 2002 to 2003.

By using commercial aircraft, the U.S. hopes to reduce the overcrowding at three U.S. military hubs in Europe and the Middle East. U.S. officials have designated at least one additional military base in the U.S. to provide housing for arriving Afghan evacuees, and have eased foreign flight rules to allow overseas carriers to ferry Afghans to the U.S.

The commercial aircraft used by the military will retain their civilian status and will operate under Federal Aviation Administration regulations, the Pentagon said. But they will be under the control of the U.S. Transportation Command, which is responsible for U.S. military flights, it said.

Carriers were notified through an official warning Friday night that the Civil Reserve Air Fleet could be activated, according to an industry official. Two flights carrying evacuees were scheduled to leave Qatar early Monday morning for Dulles International Airport outside of Washington, D.C., which is expected to become the central processing site for a surge of Afghan evacuees, officials said.

United Airlines officials said four of their Boeing 777-300 aircraft had been activated. The airline said it expected minimal operational impact but will contact any customers whose flights are impacted.

“We embrace the responsibility to quickly respond to international challenges like these and use our expertise to ensure the safe passage of our fellow countrymen and women as well as those who have risked their lives to help keep them safe,” the airline said in a statement.

American Airlines said it would be ready Monday to deploy three wide-body aircraft to military bases and “other secure transit points” on the Arabian Peninsula and in Europe to assist with emergency evacuations.

“The images from Afghanistan are heartbreaking. The airline is proud and grateful of our pilots and flight attendants, who will be operating these trips to be a part of this lifesaving effort,” the airline said in a statement.

American Airlines said it would work to minimize the impact to customers as it temporarily removes the three aircraft from its operation.

Officials with Atlas, which works with the military on cargo flights, said it would fly passenger aircraft, though didn’t specify what kind.

Afghan men and children inside a villa complex in Doha, Qatar, where refugees who recently arrived from Afghanistan were beginning to settle.

Photo: karim jaafar/Agence France-Presse/Getty Images

Delta said it is scheduled to operate multiple flights to the U.S. starting Monday morning. The airline will stage aircraft at various military bases and said it plans to use spare planes, so its commercial operations won’t be affected.

In discussions last week, airlines had offered to operate charter flights to support the air lift on a voluntary basis, industry officials said.

In a related move, the Transportation Department issued an order Friday granting foreign carriers that wouldn’t otherwise be allowed to land in the U.S. blanket authority to conduct U.S.-government-sponsored evacuation flights to U.S. airports, until Sept. 30. The order, sought by State Department and Pentagon officials, is aimed at helping move evacuees from overseas military bases to sites in the U.S.

Southwest Airlines Co. said it planned to operate domestic charter flights for the Department of Defense to help transport evacuees arriving in the U.S. The airline plans to operate four flights Monday and expects the same number Tuesday and Wednesday, though it declined to identify where the flights would go. These flights are separate from the international Civil Reserve Air Fleet operations.

President Biden and U.S. officials on Sunday also warned of the potential for Islamic State militants to hamper evacuation efforts by attacking Americans. A State Department alert Saturday warning U.S. citizens and others to avoid airport gates was prompted by a fear of an Islamic State attack, officials said.

“We know that terrorists may seek to exploit the situation and target innocent Afghans or American troops. We’re maintaining constant vigilance to monitor and disrupt threats from any source,” Mr. Biden said, contending that the Islamic State presence in the country is the most concerning.

Earlier Sunday, Jake Sullivan, President Biden’s national security adviser, told CNN that the threat of a terrorist attack at Kabul’s international airport “is real. It is acute. It is persistent.

Pentagon officials are preparing at least one more U.S. base, Joint Base McGuire-Dix-Lakehurst in New Jersey, to begin to receive Afghan refugees. But as the crisis in Kabul unfolds and other nations have grown wary of housing large numbers of Afghan evacuees, the U.S. has begun taking a harder look at its own facilities in the U.S. and overseas, officials said.

A tent city is being erected at the New Jersey base and medical supplies, food, water, restrooms, lighting and other equipment are being installed there now, officials said. Evacuees could be there by next week, they said.

Other bases being studied as potential housing sites include Fort Pickett, Va., Camp Atterbury, Ind., Fort Hunter Liggett, Calif., and Fort Chaffee, Ark. Pentagon officials are also looking at American bases in Japan, Korea, Germany, Kosovo, Bahrain and Italy, officials said.

The Pentagon earlier had identified Fort Lee, Va., Fort Bliss, Texas, and Fort McCoy, Wis., as bases that were to begin housing refugees.

Write to Gordon Lubold at Gordon.Lubold@wsj.com, Nancy A. Youssef at nancy.youssef@wsj.com and Alison Sider at alison.sider@wsj.com