How can I make 3 wire sub-panels compliant with current codes?
TL;DR: your subpanels are seriously screwed up.  Fixing it will require running wires, because the last installer was likely an idiot

We start this journey in NEC 215.6:


  215.6 Feeder Equipment Grounding Conductor. Where a feeder supplies branch 
  circuits in which equipment grounding conductors are required, the feeder shall 
  include or provide an equipment grounding conductor in accordance with the 
  provisions of 250.134, to which the equipment grounding conductors of the branch 
  circuits shall be connected. Where the feeder supplies a separate building or
  structure, the requirements of 250.32(B) shall apply.


Since all your panels are in the same structure, 250.32(B) is irrelevant (and so is the length of the feeders -- the NEC doesn't care about how long a feeder is provided the voltage drop is within limits), so we move on to 250.134:


  250.134 Equipment Fastened in Place or Connected by Permanent Wiring Methods 
  (Fixed) - Grounding. Unless grounded by connection to the grounded circuit 
  conductor as permitted by 250.32, 250.140, and 250.142, non-current-carrying 
  metal parts of equipment, raceways, and other enclosures, if grounded, shall 
  be connected to an equipment grounding conductor by one of the methods 
  specified in 250.134(A) or (B).
  
  (A) Equipment Grounding Conductor Types. By connecting to any of the 
  equipment grounding conductors permitted by 250.118. 
  
  (B) With Circuit Conductors. By connecting to an equipment grounding 
  conductor contained within the same raceway, cable, or otherwise run with the 
  circuit conductors.
  
  Exception No. 1: As provided in 250.130(C), the equipment grounding conductor 
  shall be permitted to be run separately from the circuit conductors.


Once again, we ignore the reference to 250.32, but now there are several issues at hand.  First, 250.140 is also irrelevant, as it deals solely with electric ranges and dryers, not feeders.  While 250.142(B) looks promising,


  (B) Load-Side Equipment. Except as permitted in 250.30(A)(l) and 250.32(B) 
  Exception, a grounded circuit conductor shall not be used for grounding non-
  current-carrying metal parts of equipment on the load side of the service 
  disconnecting means or on the load side of a separately derived system 
  disconnecting means or the overcurrent devices for a separately derived system 
  not having a main disconnecting means.
  
  Exception No.1: The frames of ranges, wall-mounted ovens, counter-mounted 
  cooking units, and clothes dryers under the conditions permitted for existing 
  installations by 250.140 shall be permitted to be connected to the grounded
  circuit conductor.
  
  Exception No.2: It shall be permissible to ground meter enclosures by 
  connection to the grounded circuit conductor on the load side of the service 
  disconnect where all of the following conditions apply:
  
  (1) No service ground-fault protection is installed.
  
  (2) All meter enclosures are located immediately adjacent to the service 
  disconnecting means.
  
  (3) The size of the grounded circuit conductor is not smaller than the size 
  specified in Table 250.122 for equipment grounding conductors.
  
  Exception No.3: Direct-current systems shall be permitted to be grounded on 
  the load side of the disconnecting means or overcurrent device in accordance 
  with 250.164.
  
  Exception No.4: Electrode-type boilers operating at over 1000 volts shall be 
  grounded as required in 490.72(E)(1) and 490.74.


none of the exceptions to it apply at all to your situation, and the reference to 250.32(B)'s exception is also, again, irrelevant.  In addition, 250.30(A)(1) is inapplicable as it deals solely with separately derived systems (such as a generator) and not utility mains service.

This leaves us with 250.130(C):


  (C) Nongrounding Receptacle Replacement or Branch Circuit Extensions. The 
  equipment grounding conductor of a grounding-type receptacle or a branch-
  circuit extension shall be permitted to be connected to any of the following:
  
  (1) Any accessible point on the grounding electrode system as described in 
  250.50
  
  (2) Any accessible point on the grounding electrode conductor
  
  (3) The equipment grounding terminal bar within the enclosure where the branch 
  circuit for the receptacle or branch circuit originates
  
  (4) An equipment grounding conductor that is part of another branch circuit 
  that originates from the enclosure where the branch circuit for the receptacle 
  or branch circuit originates
  
  (5) For grounded systems, the grounded service conductor within the service 
  equipment enclosure
  
  (6) For ungrounded systems, the grounding terminal bar within the service 
  equipment enclosure


Unfortunately for you, point 5 here isn't a blanket authorization to do what was done in your house, just the ability to run a new ground wire back to the neutral busbar in your service panel.  So, you'll have to run ground wires back from the subpanels to a point tied into the grounding network, then separate neutral and ground at all the subpanels.

As to Longneck's concern about broken ground wires -- while running a single ground wire by itself may be Code (it depends on how your AHJ interprets 250.130(C)), there are two vastly better options:


Run new RMC from the main panel to the subpanels via whatever route is convenient and use the RMC itself as a grounding conductor as per 250.118 point 2; this RMC can be sized to accommodate a future feeder upgrade as well, if such a thing is ever needed.  However, this approach does have a much higher upfront cost, as running conduit's quite a bit of work.
Run a single bare conductor type MC cable as per 250.118 point 10(a).  This is easier/faster than running conduit, but means you'll have to tear both it and the old feeders out to run new feeders in the future.  It does address longneck's concerns about a single bare wire being snipped, though -- cutting MC cable is not something one does save for a full-scale demolition!  (The 6/1 I linked is adequate for any subpanel you'll ever find in a residential setting, by the way -- Table 250.122 allows for a 6AWG copper grounding conductor for all circuits up to 200A.)