Magnetic properties (coercivity and magnetization) of ferromagnetic films are strongly affected by the proximity to materials that undergo a metal to insulator transition. Here, we show that stress associated with structural changes across the metal-insulator phase transition in VO2 and V2O3 produces a magnetoelastic anisotropy in ferromagnetic films (Co and Ni) deposited on top of the oxides. The changes in coercivity are as large as 168% and occur in a very narrow temperature range. This effect can be controlled and inverted by the thickness and the deposition temperature of the ferromagnetic films, which is very flexible for important technological applications.