According to this document:
He knew that a metallic object near an inductor changes the value of
the inductance. If a listening device, such as a telephone, was
connected to an audio frequency source, the change in induction would
also change the audio signal. This change would be heard by the
listener. With Bell’s recent invention, the telephone, he thought that
he could hear that change.
...
Bell successfully detected bullets in sides of beef and shrapnel in
Civil War veterans. He made several attempts with variations on the
basic apparatus to locate the bullet in the President’s body. But, he
was unable to find the location of the bullet in Garfield. The
physicians in attendance attempted to find the bullet by inserting
their fingers into the bullet hole. While the idea of sterilization
had been developed by Joseph Lister in England by this time, most
doctors in the United States did not take it seriously. Thus, on
September 19, 1881, eleven weeks after being shot President Garfield
died.
Why didn't it work?
The problem was the bed he was in. Coil spring mattresses had just
been invented. In fact, a national campaign hadn't even been started
yet at the time of the assassination. The White House was one of the
few that had the coil spring mattresses at the time. Very few people
had even heard of them. Thus, Bell's and Newcomb's invention was
detecting metal -- unfortunately they didn't realize that it was the
coil springs.
The first document gives details of the interruptor coil and ticking clock used by Bell to generate alternating current in the circuit.