In Daniel's Story, a boy and girl are put in the cupboard after the chairman of the Lodz ghetto announces: "All children under ten and all old people were to be sent away." As Daniel's Story is set in the Holocaust, we know that "sent away" means murdered.
Though this wasn't crystal clear to everyone at the time, the extent of the Nazis’ killing made it hard to keep what they were doing a secret. As Daniel himself relays to us: "There were rumors that those who were deported were taken to a place called Chelmno, where they were killed."
Facing the prospect that some of their family will be murdered, Daniel's family convenes a "family meeting," where they try to sort through the possible scenarios: Who's stronger? Who's weaker? Who's more likely to stand out and be selected?
The family settles on Friedrich and Erika. Both are "small and skinny." To shield them from the Nazis, Friedrich and Erika hide in the cupboard. To make the hiding spot harder to notice, they remove the cupboard handle and put a bed in front of it.
When the Nazi secret police come and Daniel's family goes outside, Friedrich and Erika remain in the cupboard. There's worries that they'll suffocate, but, as you know from having read it, they don't.