Magnetic phase transitions in nanostructures induced by shear stress under high pressure