Recently, lead halide perovskites have gained considerableattentionby dint of their predominant physiochemical features and potentialuse in various applications with an improved power conversion efficiency.Despite the incredible technological and research breakthroughs inthis field, most of those compounds present an obstacle to futurecommercialization due to their instability and extreme poisonousness.Because of this, it is preferable to replace lead with alternativestable elements to produce eco-friendly perovskites with equivalentoptoelectronic qualities similar to lead-based perovskites. However,Pb-free perovskite-based devices have relatively low power conversionefficiency. Pressure might be considered an effective way for modifyingthe physical characteristics of these materials to enhance their performanceand reveal structure-property correlations. The present studyhas been done to investigate the structural, electronic, optical,elastic, mechanical, and thermodynamic properties of nontoxic perovskiteCsMgI(3) under hydrostatic pressure by using density functionaltheory (DFT). At ambient pressure, the present findings are in excellentagreement with the available experimental data. Pressure causes theMg-I and Cs-I bonds to shorten and become stronger.The absorption coefficient in the visible and ultraviolet (UV) zonesgrows up with the increase in pressure. Additionally, we have observedlow reflectivity, a high-intensity conductivity peak, and a dielectricconstant in the visible region of the electromagnetic spectrum. Aspressure rises, the band gap keeps narrowing, facilitating an electronfrom the valence band to get excited easily at the conduction band.Furthermore, we analyze the mechanical, elastic, and thermodynamicproperties under pressure, which suggests that this compound exhibitductile behavior. The shrunk band gap and improved physical propertiesof CsMgI3 under hydrostatic pressure suggest that thismaterial may be used in solar cells (for photovoltaic applications)and optoelectronic devices more frequently than at ambient pressure.In addition, this paper emphasizes the feasibility of hydrostaticpressure in the systematic modification of the optoelectronic andmechanical characteristics of lead-free halide perovskites.