A battery will release its charge if you create a circuit between the positive and negative terminals. If you toss batteries in a container with other metal items, you could potentially create a short circuit and cause an accidental discharge.
Cylindrical batteries, like the ones in a remote control or flashlight, have their terminals on either end. This makes it difficult to create a circuit by accident, since you must create a complete loop between them for current to flow. However, if you store batteries in a container with metallic items such as keys, coins or silverware, it is possible they could connect in a way that creates a connection from one terminal to the other. Over time, this will drain the batteries' charge and could lead to damage or a leak.
Nine-volt batteries are a special case, since they have both terminals on top of the battery casing. This makes it much easier to connect the positive and negative terminals by accident. For this reason, manufacturers usually ship nine-volt batteries with a plastic cap covering the terminals to prevent short circuits.