The gut is home to 70 to 80 percent of the immune cells in the body. It seems to me when you give it a break from a constant influx of food, that potentially frees up immune cells to do other things for a bit.
I do believe that makes sense and is part of the common "wisdom" of the diet. However more sizeable research studies need to be done in order to add strength to the hypothesis. These are far to small other than as pointers of what might be possible
I sort of think of it like "maintenance downtime." It was my son that first suggested to me it helps by freeing up immune cells and letting them concentrate on other things for a bit and I think that makes a lot of sense.
I also suspect that dropping your blood sugar levels low enough, long enough helps starve some invaders. We are bigger than the bacteria in our system. We can survive for a bit without those resources. Maybe some of them can't.