Connect 2 computers to the same modem

If it's an Internet modem, with its output being a network connection, you buy a small Ethernet switch or hub.

If it's a classical serial modem, you would need something like an A-B switch that would allow you to switch which computer is on it at a given time; they can't both use it at the same time.

What kind of modem? And why is this in the Video sub-forum?