Every now and then people do things that indicate they are not fully attending to their current situation. For example, they will put their shirt on backwards. Or they will forget whether or not they've put on face wash while taking a shower. Most of the time, people are looked down upon when they make such a mistake, and if it happens a lot they will begin to be called names such as "space cadet." And to the extent that the activities in which these people are making dumb mistakes have instrumental value, there may be some reason to look down upon them.
But there are also benefits to spacing out that are often ignored. The first step towards recognizing these benefits is to reframe the behavior from "spacing out" to "turning on autopilot mode." When you're in autopilot mode, you mostly ignore your external surroundings because allocating cognitive resources attending to them is not very valuable. This could be the case either when you've performed a task so many times that you can accomplish it without thinking, or when the task itself is so trivial that making a decision one way or another will not have much impact.
There are probably many benefits of being in autopilot mode, but two strike me as especially important. First, it simply frees up time to ponder other, more important subjects. Especially if you are in the habit of writing your good ideas down, this can be immensly valuable. Second, it will lead to less ego depletion. We only have so much willpower to allocate over the course of the day, so if you spend it on pointless stuff like deciding what pair of jeans to wear you'll have less of it when you want to focus during a meeting or write a paper.
Even from this perspective, spacing out is undoubtedly still sometimes a maladaptive strategy, like when one is driving. However, when approached from a tactical perspective, it likely to pass a cost-benefit analysis in a number of circumstances. In anecdotal accounts, I've witnessed a high correlation between space cadetishness with high intelligence and/or output, especially in academia. At some point, one must consider the possibility that there might be an element of causation there.