Based on experimental concentration depth profiles of the antiinflammatory drug dexamethasone in human skin, we model the time-dependent drug penetration by the 1D general diffusion equation that accounts for spatial variations in the diffusivity and free energy. For this, we numerically invert the diffusion equation and thereby obtain the diffusivity and the free-energy profiles of the drug as a function of skin depth without further model assumptions. As the only input, drug concentration profiles derived from X-ray microscopy at three consecutive times are used. For dexamethasone, skin barrier function is shown to rely on the combination of a substantially reduced drug diffusivity in the stratum corneum (the outermost epidermal layer), dominant at short times, and a pronounced free-energy barrier at the transition from the epidermis to the dermis underneath, which determines the drug distribution in the long-time limit. Our modeling approach, which is generally applicable to all kinds of barriers and diffusors, allows us to disentangle diffusivity from free-energetic effects. Thereby we can predict short-time drug penetration, where experimental measurements are not feasible, as well as long-time permeation, where ex vivo samples deteriorate, and thus span the entire timescales of biological barrier functioning.