Broadly, Henry's law—i.e., that the equilibrium solubility of a gas $i$ in a liquid scales linearly with the partial pressure $P_i$ of that gas above the liquid—is, like any equilibrium relation, a(n approximate) implication of the Second Law, which states that the entropy $S$ is maximized at equilibrium ($dS=0$, $d^2S<0$).
From this, we obtain that the Gibbs free energy $G=U-TS+PV$ is minimized at constant temperature $T$ and pressure $P$ ($dG=0$, $d^2G>0$) when no work other than expansion work is considered.
The Gibbs free energy at the molar level for entrance of some amount $N_i$ of an individual substance defines the chemical potential ($\mu_i\equiv\left(\frac{\partial G}{\partial N_i}\right)_{T,P,N_{j\neq i}}$), which mediates how matter moves: At equilibrium, the chemical potentials of any component in the gas phase and dissolved in the liquid—more generally, any condensed matter—are equal: $\mu_i$ is constant and uniform.
Consequently, the thermodynamic activities ($a_i\equiv e^{\mu_i/RT}$) of component $i$ in the dissolved and gaseous states are also equal.
(For that matter, the activities of the liquid and its vapor above are equal as well. Furthermore, the activity of pure condensed matter is simply 1; put another way, we take this state as the reference state. This lets us relate the equilibrium vapor pressure to the enthalpy of vaporization, which shows up in the chemical potential $\mu$. In this way, all materials can be modeled as having a vapor-pressure temperature dependence of $e^{-1/T}$.)
Finally, the activity of a gas can often be approximated by its partial pressure (as mediated by the fugacity), and the activity of a solute can often be approximated by its concentration (as mediated by the activity coefficient). From all these assumptions and idealizations, we obtain Henry's Law. But more generally, the broader framework (starting from entropy maximization and proceeding through the relevant thermodynamic potential, e.g., the Gibbs free energy) advantageously would let one derive a more general law that also incorporates, say, gas nonideality, or gravity, or solute interaction, or surface area, or an applied electric or magnetic field, etc.