Based on a two-dimensional extended Hubbard model with electron-phonon interaction, we have studied the effect of polaron formation on the charge ordering (CO) transition. It is found that for fully ferromagnetically ordered spins the CO state may go through a process of appearance, collapse, and reappearance with decreasing temperature. This is entirely due to a temperature-dependent polaron bandwidth. On the other hand, when a paramagnetic spin state is considered, only a simple reentrant behavior of the CO transition is found, which is partly due to the polaron effect. This model is proposed as an explanation of the observed reentrant CO in the layered manganite LaSr2Mn2O7.