Trying to turn comments into an answer - though I'm with Peter's answer too...
Someone has to take charge - who that may be might depend on who is normally in charge, who noticed it, who can think how to fix it without further confusing the situation... it's not easy & I'm not sure how much preparation can go into 'practising' for such a recovery.
By definition everybody up until a point thinks what they're doing is still 'right'.
Sometimes it can take a player to stop, listen, analyse & then gather everybody's head together - visually by waving, mouthing the count big & strong, conducting, etc , in order to pull off the rescue.
I think it was Live8*, Duran Duran during the drum solo, lost track of the backing percussion track & drifted 2 beats across the instrumental/drum break - all hell was on trying to get them back, as the backing track was unforgiving. I laughed as I cried. It happens. A really clever drummer can 5/4 a bar & get everybody back on it without the audience noticing.
* I actually saw this live on the day so I know it happened, but I cannot find it anywhere on YouTube etc. I may have the wrong gig in my mind.
If the drummer 5/4s a bar it will if nothing else, make the rest of the band really think about what the heck just happened.
A solo performer can take his own sweet time to find the perfect place to 5/4 - see this from Harry Connick Jr, when his audience were irritatingly all clapping the on-beat instead of the off.
This is time-stamped to just the performance - the full video has an explanation first, which is probably more use to non-musicians.
Imported from my comment on another answer...
In rehearsals, I'd avoid the 'stopping for screwups' unless you're on first rehearsal for a new song. Learn to work them through if they happen. You can go back later & iron out the rough spots, but your team has to be ready to tackle every song top to bottom as though it was a live show. You should also routine 'the set' * without pauses.
If you're a regular working band, this just shouldn't be happening. If it's a track you've done a dozen times before & you're still having screwups, it's time to start pointing fingers & finding players who don't screw up.
*One thing about routining 'the set' is it's as dull as f***. Get used to it, suck it up. Play it like you don't mean it at all.. but play it - until you know it inside out & back to front
Then when you take it live, the audience & your performance will provide the enjoyment. The 'work' was already done - this is the reward.