By means of a particle-in-cell simulation we study the effect of time-dependent tunneling ionization in the harmonics generated during the formation of a plasma when a laser field impinges on a solid slab. The comparison of our results with preionized plasma calculations and with a simple propagation model, in which the dynamics of ionized charges is neglected, shows the crucial role of the ionization even when the ionization time is a relatively small fraction of the pulse duration. The mechanism for which the harmonics are generated owing to ionization is investigated by means of a moving-mirror model extended to take into account the time-dependent reflectivity.