The nature of the lattice instability connected to the structural transition and superconductivity of (Sr,Ca)$_3$Ir$_4$Sn$_{13}$ is not yet fully understood. In this work density functional theory (DFT) calculations of the phonon instabilities as a function of chemical and hydrostatic pressure show that the primary lattice instabilities in Sr$_3$Ir$_4$Sn$_{13}$ lie at phonon modes of wavevectors $mathbf{q}=(0.5,0,0)$ and $mathbf{q}=(0.5,0.5,0)$. Following these modes by calculating the energy of supercells incorporating the mode distortion results in an energy advantage of -14.1 meV and -9.0 meV per formula unit respectively. However, the application of chemical pressure to form Ca$_3$Ir$_4$Sn$_{13}$ reduces the energetic advantage of these instabilities, which is completely removed by the application of a hydrostatic pressure of 35 kbar to Ca$_3$Ir$_4$Sn$_{13}$. The evolution of these lattice instabilities is consistent with experimental phase diagram. The structural distortion associated with the mode at $mathbf{q}=(0.5,0.5,0)$ produces a distorted cell with the same space group symmetry as the experimentally refined low temperature structure. Furthermore, calculation of the deformation potential due to these modes quantitatively demonstrates a strong electron-phonon coupling. Therefore, these modes are likely to be implicated in the structural transition and superconductivity of this system.