Bacteria play fundamental roles for many ecosystem processes; however, little empirical evidence is available on how environmental perturbations affect their composition and function. We investigated how spatial and temporal refuges affect the resistance and resilience of a freshwater bacterioplankton community upon a salinity pulse perturbation in continuous cultures. Attachment to a surface avoided the flushing out of cells and enabled re-colonization of the liquid phase after the perturbation, hence serving as a temporal refuge. A spatial refuge was established by introduction of bacteria from an undisturbed reservoir upstream of the continuous culture vessel, acting analogous to a regional species pool in a metacommunity. The salinity pulse affected bacterial community composition and the rates of respiration and the pattern of potential substrate utilization as well as the correlation between composition and function. Compared with the no-refuge treatment, the temporal refuge shortened return to pre-perturbation conditions, indicating enhanced community resilience. Composition and function were less disturbed in the treatment providing a spatial refuge, suggesting higher resistance. Our results highlight that spatial and temporal dynamics in general and refuges in particular need to be considered for conceptual progress in how microbial metacommunities are shaped by perturbations.