Yes, this is done all the time where you have a gas fired heating boiler and a separate gas fired hot water heater. In general, both will vent up the same chimney.
I had a problem with having both a 640,000 input BTU boiler and a
251,000 input BTU hot water heater connected to the same chimney, but the problem wasn't that they vented up the same chimney, it was that they weren't connected to the chimney in the right order. Apparantly, where I live, if there's a manifold chase feeding the chimney, the smallest BTU appliance has to be connected closest to the chimney, and the larger BTU appliances have to be connected progressively further from the chimney.
In my case, I had two flues coming off my boiler, but the water heater connected to the chase BETWEEN where the two flues connected to the chase, so that was a problem. If you have two water heaters with the same BTU output, I expect you can just connect them with a wye to the chimney.
Typically, any plumbing company that installs the water heater for you will measure your chimney and determine if it's big enough. You can find sizing tables online, like the ones on this web site:
'Chimney flue size rules: Flue diameter and height requirements for Category I Draft Hood and Fan Assisted Appliances'
formatting link
If it turns out your chimney isn't large enough, there are flue blowers that can be installed that are basically flue fans that blow the flue gas up the chimney rather than rely on natural convection.