A dielectric slab will be attracted towards any source of electric field, because it is essentially a collection of dipoles. Dipoles in fields align with the fields. If the field varies in space, the dipole is drawn to the local maximum of the field. An intuitive, everyday example of this is the way iron filings are drawn to a magnet.
In the case of a constant voltage capacitor, the battery supplies the extra energy. We can see this most simply in the case that we replace the battery with a very large capacitor of capacitance $C$ connected in parallel with our original capacitor with capacitance $c_0 \ll C$. Originally, each capacitor is at a voltage $V_0$, and the large capacitor has charge $Q_0=CV_0$ while the small capacitor has charge $q_0=c_0V_0$. As we insert the dielectric, $c_0$ changes by $\Delta c$. The capacitors then settle in the new condition of equal voltage
$$\frac{Q_0-\Delta q}{C} = \frac{q_0 + \Delta q}{c_0 + \Delta c}$$
Solving for $\Delta q$ using the fact that $c_0 +\Delta c \ll C$ gives
$$\Delta q = Q_0 \frac{c_0 + \Delta c}{C} - q_0$$
From this it is fairly easy to show that the energy change in the original capacitor is
$$\Delta U_c=\frac{1}{2}\Delta c V_0^2$$
What about the change in the large capacitor? There we have
$$\Delta U_C = \frac{1}{2C}((Q-\Delta q)^2 - Q^2) \approx -\frac{\Delta q\, Q}{C}$$
Substituting gives
$$\Delta U_C=-\Delta c V_0^2$$
So overall the system ends with a lower energy, and the slab should be attracted.
Best Answer
Due to opposite charges induced on the faces of the dielectric due to the capacitor plates, the slab is attarcted. You can also see that as the dielectric goes in there is a constant rearrangement of charges, which requires work to be done. Who van do this work? Of course, thr electric field of the capacitor does thereby decreasing its own electric field by 1/k (k= dielectric const.) And this decreases the field energy finally. Edge effects also play a role here