The real lifeline for any theater facing this is having someone - even just one person - who's watched rehearsals and knows the blocking and lines, even if they haven't memorized everything yet. It doesn't have to be a full understudy system. I watched a local production handle a lead's sudden illness about a week out, and what saved them was that the stage manager had been sitting in on every rehearsal and basically knew the whole show. They promoted someone from the ensemble who had some stage presence, and that person worked with the stage manager for intensive sessions leading up to opening night. It wasn't flawless, but the audience never felt like something was broken.
For your situation with two weeks before opening, you've actually got better timing than you might think. The question is whether you have anyone in your cast or crew who already knows the script and blocking just from being around rehearsals. If not, you'll need to make some hard calls: can you cut scenes without destroying the story, can you double an actor's roles so they're doing double-duty, or can you bring in someone completely fresh and compress their prep time? Two weeks is tight but survivable if that person is available for maybe four or five rehearsals a week.
The thing that helps most is not treating this as just learning lines. Make sure whoever steps in understands the character's arc and what their scenes are actually *about*, not just the words. That helps them stay grounded when nerves kick in opening night. And honestly, audiences are more forgiving than you'd expect - they want the show to happen, and if someone's genuinely trying, they feel that effort.