The National Electrical Code (NEC) requires homeowners and electricians to install grounding-type receptacles on 15A and 20A branch circuits. In old two-wire non-grounding receptacles, you can either replace it with a GFCI device, install three-prong receptacles and ground them, or replace it with another kind of two-prong that can be grounded.
The simplest method is to add a ground fault circuit interrupter (GFCI) at the beginning of each circuit. Find the first receptacle in the circuit (the one first in line from the breaker or fuse panel) and hook it to the "line" side of the GFCI. Then connect the wire going to the remaining outlets on that circuit to the "load" side of the device. Now you can replace all the remaining outlets on that circuit with regular three-prong grounded outlets. These work well for all outlets except for major appliances like refrigerators.
If you have metal armored cable that contains the wires to the box, you can install three-prong receptacles and ground them in the following manner. First, with the power disconnected, replace the two-prong outlets with three-prong. Connect a green jumper wire (which you can buy with a screw already mounted in it at hardware stores) from the green grounding nut on the new receptacle to the box. Screw the jumper wire into the 10/32 threaded hole in the box. Make sure the armored cable is firmly attached by a metal clamp inside the box. If the box has no threaded hole, you will have to drill a hole only slightly smaller than the screw and drive the screw in tight. If the wires are not in armored cable, you cannot ground them according to code. Use the GFCI as detailed above.
In other cases, two-wire circuits without GFCI protection can be replaced with two-prong receptacles that can ground if you bond the grounding to any locations including an electrode system, conductor, panelboard equipment-grounding terminal or a grounded service conductor. These will be safe installations because they will not suffer shorts or voltage problems.