Can a Ground Wire be attatched to a nail in wood stud?
Install equipment in real junction boxes

I've done a lot of wiring and I cannot imagine how you would get a ground wire anywhere near a 2x4.  Your wires (including ground) are doing one of two things:  traveling inside a conduit (pipe) into a junction box, or travel inside a cable and the whole cable enters a junction box, so ground is inside the junction box too.  The junction box entirely encloses the wires.  How would a wire get outside a junction box to reach a 2x4 and a nail??? 

And then I realized... you're not using a junction box, are you?  Use a junction box.  You really, really want a junction box for 240V power such as is used by a heater. 



Here's an example of a Steel City brand metal junction box. There are many kinds.  This particular one looks like 


a new-work box (before drywall goes up) with flanges to make it rather easy to attach to a 2x4.  
It has an offset to allow for standard drywall thickness  
standard threaded holes to mount standard yokes (switches, receptacles, thermostats etc.) The yoke then has screws to mount a standard cover. 
Is extra-wide and deep  for extra wire space
Has built-in clamps specifically for NM cable, and a few knockouts for anything that takes a knockout (e.g. conduit). 
has a green ground screw for pigtailing a ground. This only attaches 1 wire, but that wire is then wire-nutted to the other ground wires.  Inside the box obviously. 


I presume you'll want an old-work type box for fitting into existing drywall or onto an existing 2x4, etc.  The big-box stores have a selection, but a proper electrical supply house will have a better selection. 

All electrical connections must be inside a junction box.  It is not legal or safe to splice any wire or fit any device outside a junction box.  Additionally, every junction box must be accessible without dismantling the building.  You must be able to remove the junction box cover without needing any tools except to unscrew the cover screws. 

Retrofit a real ground

You do realize as of 2014, it is perfectly legal to retrofit grounds.  Just run an Actual Ground Wire from the place you are trying to ground (or anywhere connected to it by an appropriately sized ground wire, i.e. either end of those two ground wires) to anywhere on your equipment grounding system (downstream of the service panel) where the ground wire back to the panel is >= the size of this ground wire, or anywhere on your grounding electrode system i.e. the bare wire from your service panel to the water pipe, ground rod, wherever the panel gets its grounding from.  

Do not simply ground to a water pipe, the goal isn't just to reach ground (that only helps with natural electricity like ESD, whose source is earth) -- the goal is mainly to reach the panel's equipotential bonding point, so that human-made electricity can be returned to its human-supplied source, i.e. the neutral wire.  Electricity flows in loops and electricity must be returned from whence it came.