If itís really a freewheeling diode, also called a snubbing diode, itís usually placed, with reverse polarity, across the power leads of an inductive circuit. When normal polarity power is applied, the diode is reverse-biased and does nothing. When the power switch (or relay, push button or whatever, opens, the magnetic energy in the coil can generate a reverse polarity spike. With a snubber diode, this reverse spike is shorted out and hopefully dissipated as heat. The diode is used to protect the switch contacts.
With a STOP solenoid as you described, the diode normally connect the diode across the two wires at the solenoid. It will still work
if itís connected anywhere from the solenoid +12 to ground. You can buy 200-volt, 6amp axial lead diodes for about 50 cents.
Being cautious, and not having the wiring
diagram for YOUR motor handy, I would verify that itís really supposed to be a snubber diode. If itís really wired back to some voltage source other than the Stop switch, then itís being used for some other purpose.