[Many places do not have a separate empty jail facility with enough capacity to have the inmates transferred to.]
Unfortunately, there’s a ton of Supreme Court decisions from the past 40 years that would have to be overturned or suspended, in addition to Federal laws. Basically, even in emergencies governments are not allowed to overcrowd prisons. (Mostly due to California deciding that banning the construction of new prisons was actually an emergency and abusing the hell out of the prior exceptions.) If your jail becomes overcrowded, you MUST release prisoners - no exceptions.