You can certainly use a virtual machine as a Jenkins slave.
All you need to do is set up a VM (OS based on your requirement) to automatically start a service that runs a script to start Jenkins slave.
So if your host is a windows machine which is the Jenkins master, the VM could be used as a slave machine.