The bandgap tunability of mixed-halide perovskites makes them promising candidates for light-emitting diodes and tandem solar cells. However, illuminating mixed-halide perovskites results in the formation of segregated phases enriched in a single halide. This segregation occurs through ion migration, which is also observed in single-halide compositions, and whose control is thus essential to enhance the lifetime and stability. Using pressure-dependent transient absorption spectroscopy, we find that the formation rates of both iodide-and bromide-rich phases in MAPb(BrxI1-x)3 reduce by 2 orders of magnitude on increasing the pressure to 0.3 GPa. We explain this reduction from a compression-induced increase of the activation energy for halide migration, which is supported by first-principle calculations. A similar mechanism occurs when the unit cell volume is reduced by incorporating a smaller cation. These findings reveal that stability with respect to halide segregation can be achieved either physically through compressive stress or chemically through compositional engineering.