The first battery contains 12V∗200Ah=2400Wh=2.4kWh of energy when fully charged. The second battery contains 24V∗200Ah=2400Wh=4.8kWh of energy when fully charged. 4.8kWh=2∗2.4kWh . In other words, the second battery contains twice as much energy as the first one.
This doesn’t mean that the 24V battery is simply ‘better’, however. Devices are designed to operate off a certain voltage. If you try to operate a 12V device off a 24V battery, you’ll likely fry that device. In other words, the two batteries are not interchangeable.
Or, in other words, if you need a 12V battery, for example in a car, you can’t put a 24V battery in. If you want the same amount of energy, you’ll need a 12V400Ah battery, or two 12V200Ah batteries in parallel. Don’t connect them in series, or you end up with a 24V 200Ah battery pack.