Observations in space and laboratory plasmas suggest magnetic reconnection as a mechanism for ion heating and formation of non-Maxwellian ion velocity distribution functions (IVDF). Laser-induced fluorescence measurements of the IVDF parallel to the X line of a periodically driven reconnection experiment are presented. A time-resolved analysis yields the evolution of the IVDF within a reconnection cycle. It is shown that reconnection causes a strong increase of the ion temperature, where the strongest increase is found at the maximum reconnection rate. Monte Carlo simulations demonstrate that ion heating is a consequence of the in-plane electric field that forms around the X line in response to reconnection.