This was a Roman practice, under the notion that it kept off
the plague. L. Manlius was named dictator (A.U.C. 390) “to drive the
nail.”
Our cottagers still nail horseshoes to thresholds to ward off
evil spirits. Mr. Coutts, the banker, had two rusty horse-shoes
fastened on the highest step outside Holly Lodge.
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894