We present the first direct measurements of Casimir-Polder forces between solid surfaces and atomic gases in the transition regime between the electrostatic short-distance and the retarded long-distance limit. The experimental method is based on ultracold ground-state Rb atoms that are reflected from evanescent wave barriers at the surface of a dielectric glass prism. Our novel approach does not require assumptions about the potential shape. The experimental data are compared to the theoretical predictions valid in the different regimes. They agree best with a full QED calculation.