The only thing absolutely necessary for theater is an audience.
Let’s think about this a little more deeply, by considering two complementary examples.
Here’s the first example: If you have people up on stage acting, and there is nobody in the audience, that’s not theater.
Here is the second example: If you have an empty stage, and an audience is sitting there experiencing it, that’s essentially a variation on John Cage’s 4’33”. Unlike the first example, it is arguably theater, albeit very avant garde theater.