If the PC's run Linux, you only need two trivial daemons forwarding the keypresses from one to the other.
The basic code is trivial; it only becomes harder if you want to secure the connection (using OpenSSL or similar).
If you want, I can show you the basic daemon C code. This easily scales to more than two machines, and more than two keyboards, as well.
If you want a hardware solution, use
N+1 microcontrollers with a native USB interface, with
N devices, and one host.
(You can do with
N microcontrollers, if one of the ones with a native USB client interface also has an USB host interface.)
On
N-1 USB connections to the PCs, use an USB isolator, to avoid ground loops. The cheap eBay ones work well for max. 12Mbit/s USB, which is perfectly fine for keyboards and mice and many USB audio devices. If this is used strictly with laptops on battery power, you can omit the isolators.
I would probably use
N Pro Micros (same ATmega32u4 as in Leonardos, but much smaller board; the 5V/16MHz model, not 3.3V/8MHz), one USB host shield, and
N ADuM4160/3160-based USB isolators, because I know these work well together (except I haven't used any of the USB host shields). On fleabay, pro micros and the USB host shield cost about 4€ apiece, and the USB isolators about 8€ apiece. For
N=2, this comes to about 25€ or so.
If you can use a PS/2 keyboard, then you don't need to use the USB host shield. You can use the
PS2Keyboard library with Pro Micros, because they use the same ATmega32u4 microcontroller as Teensy 2.0.
The idea is that the microcontrollers have a shared ground, and exchange key press information using UART, SPI, or I2C. For a pair of microcontrollers, the UART makes the most sense.