New instalations of three-pronged receptacles must include a grounding connection.
NEC 406.3 General Installation Requirements.
(B) To Be Grounded. Receptacles and cord connectors
that have grounding contacts shall have those contacts
effectively grounded.
However, there is no requirement for the
replacements to be grounded.
Here are your options.
NEC 406.3 General Installation Requirements.
(D) Replacements.
(3) Nongrounding-Type Receptacles. Where grounding means does not exist in the receptacle enclosure, the installation shall comply with (a), (b), or (c).
(a) A nongrounding-type receptacle(s) shall be permitted to be replaced with another nongrounding-type receptacle(s).
(b) A nongrounding-type receptacle(s) shall be permitted to be replaced with a ground-fault circuit interrupter-type of receptacle(s). These receptacles shall be marked “No Equipment Ground.” An equipment grounding conductor shall not be connected from the ground-fault circuit-interrupter-type receptacle to any outlet supplied from the ground-fault circuit-interrupter receptacle.
(c) A nongrounding-type receptacle(s) shall be permitted to be replaced with a grounding-type receptacle(s) where supplied through a ground-fault circuit interrupter. Grounding-type receptacles supplied through the ground-fault circuit interrupter shall be marked “GFCI Protected” and “No Equipment Ground.” An equipment grounding conductor shall not be connected between the grounding-type receptacles.