It’s depends, if only you want a Speed Control, you can connect 2 motors with a VFD; You have to consider, you are limited in current, and have to look at the max. current which is provided by the VFD. For the rest, as well as it’s said by the mates, you have to take care with the thermal protections. Don’t forget that the motor’s velocity has to be the same.
Make sure that the two motors’ total power rating does not more than the VFD power capacity. For Example if u want to connect 2 motors of 30 kW each then use the 60 kW VFD. Its good practice to use slightly more power of VFD then the total power of 2 motors.