Is it safe to sleep in the same room with a car battery?
With any larger battery with significant potential energy, exceeding the discharge rate, over charging, charging when at end of life, or physical abuse can lead to explosions, unexpected venting of acid, or overheating that can cause a fire. The battery should be in a properly vented, protective case that safeguards the terminals and there should be an appropriately sized fuse on one or both terminals of the battery where the load and charger connects.
If the battery is simply being stored (not charged or discharged) in the room and it is in a proper protective case, then it is perfectly safe.
If the battery is the type with removable caps, then care must be taken during charging due to the release of hydrogen gas during the charging process. Of course the acid in the battery is quite corrosive should the battery be tipped or if the case becomes damaged.
If the battery is an AGM (absorbtive glass mat) or gel cell type then there is no danger of off-gassing during normal operation. These styles of batteries will not leak if tipped - many are rated to work even when placed on their side or inverted.
Batteries also produce hydrogen and oxygen if overcharged, in just the right ratio for an explosion, especially with sparks that can also be present when connecting and disconnecting. These can build up inside the battery and rupture the case when they blow (see @Eugene Sh. comments about H2SO4).
Gassing:
With a sealed battery and a modern charger it may often not be a problem, but the possibility of danger exists.
Modern sealed batteries are generally not rated to withstand substantial pressure. If "gassing" occurs due to overcharging they will almost certainly "vent".
This raises both the Hydrogen gas and acid hazards mentioned by others.
It happens! - ask me how I know:
I can confirm from painful & health affecting (long long ago) personal experience that sleeping in a room where a lead acid battery was charging caused severe inflammation of my mouth and throat - and probably to some extent my lung "input" area. This was extremely painful and took weeks to heal.
In my case the battery probably "gassed" badly during charging. This should not happen with a properly designed and correctly functioning charger. The result was that sulphuric acid was transferred from battery to air in a manner that allowed it to cause me harm. The room was about 3m x 3m and may have been relatively unventilated.
So, while it MAY not cause problems on many occasions, I can attest that the possibility definitely exists.
As Dmitry notes, you'd not expect sulphuric acid vapour alone to cause problems. But, by experience shows that it can. The mechanism by is uncertain. eg generated Hydrogen may have assisted vapourisation of liquid droplets in excess of the vapour pressure. Regardless of HOW it happens, it can.
____________________________
Explosion:
If a charger is faulty and keeps charging when the battery is at full capacity - or if the battery has a shorted or heavily sulphated cell so that the overall battery will not reach full voltage, then charging can continue indefinitely. This will generate copious Hydrogen (as mentioned elsewhere).
The "used top be sealed" battery shown below exploded extremely violently under these circumstances due to internal Hydrogen gas buildup.
I saw this after the event but was not present at the time. I was told that the explosion was "very impressive".
Probably didn't look quite like this photo of me (really).
Hydrogen flames tend to be clear. Battery acid mixed with the Hydrogen could be expected to add some colouration.
This photo shows acetylene burning "oxygen rich".
DO NOT try this at home.