Some monitors support two connections at a time. A few even will do picture-in-picture if so ordered. If your monitor doesn't, you need a KVM.
For two machines and VGA, KVMs are pretty cheap. If you want DVI, things get a lot more expensive. I can't give you too much specific advice, unfortunately(bought my last KVM 6 years ago, from some .com's liquidation, an older 8 port rackmount Apex box.)