The electronic structure, structural stability, mechanical, phonon, and optical properties of Zr2GaC and Hf2GaC MAX phases have been investigated under high pressure using first-principles calculations. Formation enthalpy of competing phases, elastic constants, and phonon calculations revealed that both compounds are thermodynamically, mechanically, and dynamically stable under pressure. The compressibility of Zr2GaC is higher than that of Hf2GaC along the c-axis, and pressure enhanced the resistance to deformation. The electronic structure calculations reveal that M2GaC is metallic in nature, and the metallicity of Zr2GaC increased more than that of Hf2GaC at higher pressure. The mechanical properties, including elastic constants, elastic moduli, Vickers hardness, Poisson’s ratio anisotropy index, and Debye temperature, are reported with fundamental insights. The elastic constants C11 and C33 increase rapidly compared with other elastic constants with an increase in pressure, and the elastic anisotropy of Hf2GaC is higher than that of the Zr2GaC. The optical properties revealed that Zr2GaC and Hf2GaC MAX phases are suitable for optoelectronic devices in the visible and UV regions and can also be used as a coating material for reducing solar heating at higher pressure up to 50 GPa.