Acquired resistance is one of the major barriers to successful cancer therapy. The development of resistance is commonly attributed to genetic heterogeneity. However, heterogeneity of drug penetration of the tumor microenvironment both on the microscopic level within solid tumors as well as on the macroscopic level across metastases may also contribute to acquired drug resistance. Here we use mathematical models to investigate the effect of drug heterogeneity on the probability of escape from treatment and time to resistance. Specifically we address scenarios with sufficiently efficient therapies that suppress growth of all preexisting genetic variants in the compartment with highest drug concentration. To study the joint effect of drug heterogeneity, growth rate, and evolution of resistance we analyze a multitype stochastic branching process describing growth of cancer cells in two compartments with different drug concentration and limited migration between compartments. We show that resistance is more likely to arise first in the low drug compartment and from there populate the high drug compartment. Moreover, we show that only below a threshold rate of cell migration does spatial heterogeneity accelerate resistance evolution, otherwise deterring drug resistance with excessively high migration rates. Our results provide new insights into understanding why cancers tend to quickly become resistant, and that cell migration and the presence of sanctuary sites with little drug exposure are essential to this end.