In point particle classical mechanics the action $S$ is the time integral of the Lagrangian $L$
$$S=\int Ldt$$
You can check its dimensions are of $[ML^2T^{-2}][T]=[ML^2T^{-1}]$ this is, energy times time. The constant ratio is due to the energy $E$ and frequency $\nu$ relation for photons:
$$E=h\nu \Rightarrow h=\frac{E}{\nu}$$
The "fit" that you are talking about comes of the blackbody radiation spectrum. If we use as variables temperature $T$ and frecuency $\nu$ in classical physics we have two laws:
High frecuency law: Wien's law $$I(\nu,T)=\frac{2h\nu^3}{c^2}e^{-\frac{h\nu}{kT}}$$
Low frecuency law: Rayleigh-Jeans law $$I(\nu,T)=\frac{2h kT\nu^2}{c^2} $$
There is no intermediate frecuency law. Plack assumed that radiative energy is quantized via $E=h\nu$ and interpolated the energy fitting for an expresion of the type
$$I(\nu,T)=F(\nu,T)e^{g(\nu,T)}$$
that should satisfy both limits ($\nu \approx 0, h\nu >> kT$). Finally he obtained
$$I(\nu,T)=\frac{2h\nu^3}{c^2}\frac{1}{1-e^{\frac{h\nu}{kT}}} $$
However there is a much more nicer and physical derivation of Planck's law due to Einstein that you can find in Walter Greiner Quantum Mechanics an Introduction chapter 2