The exponential decrease in density comes out naturally whenever you have a gas in hydrostatic equilibrium. The scale height $H$ is then given by the balance between the kinetic energy of the particles due to thermal motion, $kT$, and the gravitational energy of the particles, $mg$. This is often a good approximation, both in planetary and stellar atmospheres, and even in galaxies.
That is,
$$
H = \frac{kT}{mg}
$$
where $k$ is Boltszmann's constant, $T$ is the temperature, $m$ is the average mass of the particles, and
$$
g = \frac{GM}{r^2}
$$
with $G$ the gravitational constant, and $M$ the mass inside the radius $r$.
On the surface of our Sun, $g$ works out to $274\,\mathrm{m}\,\mathrm{s}^{-2}$, 27 times as high as on Earth.
The average particle mass depends weakly on metallicity, and mostly on the ionization state of the gas, since the small mass of free electrons compared to that of atoms pulls the average down. For a fully ionized gas, the mean molecular mass — i.e. the mass in terms of the hydrogen mass — is $\mu \simeq 0.6$, whereas for a fully neutral gas it is (e.g. Carroll & Ostlie 1996)
$$
\mu \simeq \frac{1}{X + Y/4 + Z/15.5} \simeq 1.25,
$$
where $X$, $Y$, and $Z$ are the mass fractions of hydrogen, helium, and metals, respectively. I mistakenly wrote initially that the gas is fully ionized, but that's not true; it is only partially ionized, and the hydrogen is largely neutral.
Taking the average mass of a particle to be roughly equal to the proton mass $m_p$ (i.e. setting $\mu=1$), and taking the temperature to be $T = 5770\,\mathrm{K}$, the scale height is thus
$$
H_\odot = \frac{kTR^2_\odot}{GM_\odot m_p} \simeq 170\,\mathrm{km}.
$$
With $\mu=0.6$ you'd get $H\simeq290\,\mathrm{km}$, while $\mu=1.25$ yields $H = 140\,\mathrm{km}$.
Realistic density profiles
The above calculation are quite basic, assuming a completely isotropic Sun. But observations and more realistic models, both 1D and 3D, do indeed predict exponential density profiles, although with quite large variations across the surface (according to a Solar physicist colleague down the hall). I found this model from these lecture notes where the yellow curve shows the number density profile in the Sun's atmosphere.

Extracting the data and plotting on a log-linear scale shows reasonable agreement with an exponential decrease of scale height $H = 140\,\mathrm{km}$:
