Student or Learner
For this magic to work, the box must have (a/the) space that can contain 2 people.
which one would you choose?
Happy Lantern Day to all Chineses
----- Not an ESL teacher -----
In order to achieve success with this magic, the box must have sufficient space for (at least) two people.
For the magic to succeed, the box should have enough space for two people.
In order to work properly, the box must have (sufficient/free) space for two people.
For the proper working of this magic, the box should contain (free) space for two people.
Above are some suggestions.
W呃've gotta get to the bottom of this! Can't have you asking about whether or not to use an article and which one for every noun in English!
Your sentence already sounds a bit over the top and somehow (pardon me for saying so) Chinglish: For this magic to work, the box must have (a/the) space that can contain 2 people.
How about: For this magic to work, the box must have space for 2 people. Short is beautiful!
Articles: we are looking for hard and fast rules about when to use 'em, and when you don't need 'em.
"For this magic to work, the box must have space for two people."
This would be (in my opinion) the most natural way to express the idea. However, the other suggestions are correct.
As teacher suggests, language does not have fixed rules. We make up rules to try to explain how we use the language, in order to make it easier to learn. However, language is too complex to express completely with simple rules. When you are fluent enough to listen to English conversations, you will hear various constructions which "break the rules". These will differ from country to country, town to town, village to village.
If possible, listen to BBC Radio English, since this will be understood by the majority of English speakers. (If you are learning American English, listen to Washington radio, or similar.)
There are many places on the Internet where you can listen to - or download - English radio programme recordings.