Connecting multiple grounds
If you have two separated circuits the voltages of the first don't mean anything to the second and vice versa. If you want to combine the circuits you'll have to connect a reference on one circuit with a reference on the other one. In 99 % of cases you'll choose the resp. grounds for this, because that's what ground is for: a reference against which all the rest is measured. If there's a 3 V level in a circuit, it will be referenced to ground, unless specified otherwise.  

So by connecting the ground of a 5 V circuit to the ground of a 12 V circuit the 5 V becomes meaningful for that circuit as well: it will also be 5 V, or 7 V less than the 12 V.  

A well designed circuit must have a reliable ground, which means that the 0 V at one point should be as close as possible to that 0 V at any other point of the ground net. Zero difference is not always possible if you're working with high currents, but the difference should be as low as possible.