In this work we study the Poisson Boolean model of percolation in locally compact Polish metric spaces and we prove the invariance of subcritical and supercritical phases under mm-quasi-isometries. In other words, we prove that if the Poisson Boolean model of percolation is subcritical or supercritical (or exhibits phase transition) in a metric space M which is mm-quasi-isometric to a metric space N, then these phases also exist for the Poisson Boolean model of percolation in N. Then we apply these results to understand the phenomenon of phase transition in a large family of metric spaces. Indeed, we study the Poisson Boolean model of percolation in the context of Riemannian manifolds, in a large family of nilpotent Lie groups and in Cayley graphs. Also, we prove the existence of a subcritical phase in Gromov spaces with bounded growth at some scale.