Along with the entirety of the crew, Kelly was killed when the Essex was destroyed at a moon of Mab-Bu VI upon being attacked by a group of disembodied criminals from a star system called Ux-Mal, who were attempting to take control of the crews' bodies and use them to escape the moon, where they had been imprisoned five centuries earlier. The Essex, however, was unable to elude the moon's electromagnetic storms, and crashed on the surface.
Nearly two-hundred years later, in the year 2368, a group of these criminals attempted to escape again, taking over the bodies of crewmembers of the USS Enterprise-D. One of the entities took control of Miles O'Brien, the ship's transporter chief, and attempted to convince Captain Jean-Luc Picard that he was, in fact, the disembodied spirit of Lieutenant Kelly. Picard, however, remained unconvinced of their story, and eventually the entities' plan was foiled, and they were returned to the moon's surface. (TNG: "Power Play")