You have to install an operating system in the virtual machine software. Its just like installing an OS after you format your hard drive.
Some gud VM softwares are- Sun Virtual box (open source) and VM ware (paid)
Very broadly (and therefore wrong in detail), it works by time slicing the actual hardware and apportioning those slices to each of the virtual machines. Each virtual machine is as if running on its own hardware, so as titan5 points out, each one needs an OS to be installed before it is of much use.