Single-crystal x-ray diffraction, density-functional band-structure calculations and muon spin relaxation ($\mu$SR) are used to probe pressure evolution of the triangular spin-liquid candidate YbMgGaO$_4$. The rhombohedral crystal structure is retained up to at least 10 GPa and shows a nearly uniform compression along both in-plane and out-of-plane directions, whereas local distortions caused by the random distribution of Mg$^{2+}$ and Ga$^{3+}$ remain mostly unchanged. The $\mu$SR data confirm persistent spin dynamics up to 2.6 GPa and down to 250 mK with no change in the muon relaxation rate. Longitudinal-field $\mu$SR reveals power-law behavior of the spin-spin autocorrelation function, both at ambient pressure and upon compression.