A KVM switch is the optimal solution as it can switch peripherals as well as the monitor.
If you don't want to purchase any additional hardware and your laptops have multiple/different video outputs you could toggle between them with your monitors input setting. In other words, connect one through DVI and another through HDMI or VGA.