There are several issues here:
1) A spark while connecting/disconnecting could ignite the gas around a battery. Notice that it could happen both when you first hook up the batteries, and also when you disconnect the cables after charging for a while. It's less likely if the engines are running their fans, or if the wind is up, but it could happen. To reduce this possibility, it can be worth it to do the last connection on the healthy vehicle, whose battery isn't under as much stress.
2) Heavy charging can boil a battery, causing an acid "explosion". The most dangerous time is probably at the start of the charging, when the battery is the most flat and thus taking in the most current. Some auto-parts store people say that they throw a new battery onto the charger for a few minutes to avoid having it blow up in people's cars when they first install them. And that's a mostly charged battery right off the shelf.
3) On many vehicles there is a smaller wire (#10, for example) connecting the frame to the battery. This smaller wire can limit the charging current and reduce danger if the battery is charged through the frame instead of directly to the posts. On other cars, the black starter cable is connected to the frame along the way to the starter, so it doesn't really limit the charging current even if you charge through the frame.
4) One convenient place which is usually available to hook up the jumper cable is the hood release catch above the radiator. It's right in front, usually not right next to the battery, and you can get a good connection.
5) Keep your face away from the charging battery. Keep on-lookers at a distance.
I once saw someone hook up the cables backwards and wait around as it "charged". What I noticed from a distance was visible gasses coming from one of the batteries. I yelled at them (from a distance) to turn it off and disconnect and let things cool for a while before doing it right. I don't remember thinking to tell them to disconnect the good battery first, since there obviously was hydrogen gas all over, but I guess the wind took care of it, as nothing exploded.