Population dynamics is constrained by the environment, which needs to obey certain conditions to support population growth. We consider a standard model for the evolution of a single species population density, that includes reproduction, competition for resources and spatial spreading, while subject to an external harmful effect. The habitat is spatially heterogeneous, there existing a refuge where the population can be protected. Temporal variability is introduced by the intermittent character of the refuge. This scenario can apply to a wide range of situations, from a lab setting where bacteria can be protected by a blinking mask from ultraviolet radiation, to large scale ecosystems, like a marine reserve where there can be seasonal fishing prohibitions. Using analytical and numerical tools, we investigate the asymptotic behavior of the total population as a function of the size and characteristic time scales of the refuge. We obtain expressions for the minimal size required for population survival, in the slow and fast time scale limits.