New York City is temporarily suspending some of the rules related to its longstanding guarantee of shelter to anyone who needs it as officials struggle to find housing for migrants arriving from the southern border.

Under an executive order, the city is suspending rules that require families to be placed in private rooms with bathrooms and kitchens, not in group settings, and that set a nightly deadline for newly arriving families to be placed in shelters.

A spokesman for Mayor Eric Adams confirmed the decision on Wednesday night, saying that the city had “reached our limit” and ended up having to place newly arrived migrants in gyms last week.

“This is not a decision taken lightly,” the spokesman, Fabien Levy, said in a statement, “and we will make every effort to get asylum seekers into shelter as quickly as possible, as we have done since Day 1.”

Republican governors of border states have been sending buses of asylum seekers to New York and other Democrat-led cities since last spring, but the city’s decision came as a federal pandemic-era rule that allowed the government to eject thousands of migrants, known as Title 42, is set to expire Thursday night. City officials have said they expect as many as 1,000 people a day to come after the rule is lifted.

Already people have been crossing into the United States from Mexico in anticipation of the change.

New York City has opened eight humanitarian relief centers as city officials have moved to help more than 61,000 migrants who have arrived over the last year.

New York is the only major city in the country that provides “right to shelter,” the result of a legal agreement that requires the city to provide a bed to anyone who needs one under certain conditions.

“We all hope that they never have to take any actions that would be in violation of these rules that they’re suspending,” said Joshua Goldfein, a staff lawyer for the Legal Aid Society, which represents the nonprofit that is the court-appointed monitor for the shelter system, the Coalition for the Homeless.

Under the nightly-deadline rule, homeless families with children who arrive at a shelter-system office by 10 p.m. must be given beds in a shelter the same night. Last July, as the number of migrants was accelerating, some families spent the night in chairs at the main office in the Bronx; it was the first time the nightly deadline had been violated since at least 2014.

“We know that they are working hard to avoid putting people in harm’s way,” Mr. Goldfein said, “but we have learned over and over again that putting families with children in congregate settings or leaving them in city offices for days on end is dangerous and harmful to children and their families.”

The city is also suspending protections for families who have been in emergency shelter hotels for more than 30 days, which officials say make it impossible to evict them without taking them to housing court.

Mr. Goldfein pushed back against that suspension, saying, “They want the ability to turn off their key cards and lock them out,” as the city did earlier this year to families who had been staying in a Lower Manhattan hotel since being displaced by Hurricane Ida in 2021.

As of Tuesday, there were 78,763 people in the city’s main shelter system, a record that has been broken nearly every day since October. Nearly half of them are migrants, the city says, spread among 120 emergency shelters and the eight larger centers.

Mr. Adams has said that housing the migrants is costing the city billions of dollars, warning last month that the city is “being destroyed” by the crisis and criticizing President Biden for his handling of the situation.

Still, the city is mandated by the longstanding legal settlement to observe the right to shelter, and Mr. Adams is likely to face criticism over his decision to reduce some of the protections. The right to shelter, rooted in court cases launched in 1979, is one reason New York City doesn’t have the same level of street homelessness as some cities in California and elsewhere.

Mr. Levy, the mayoral spokesman, said that the city was doing the best it could under difficult circumstances, “but without more support from our federal and state partners, we are concerned the worst may be yet to come.”

Raúl Vilchis contributed reporting.