If anything, the ending seems to reinforce the general themes of irrationality and randomness central to the story.
Some readers might get the impression that Poe was defeated by his own material and that the rescue at the close is unconvincing and even inadvertently comic. In the context of his oeuvre it is at least an atypical climax, since most of his stories conclude with some horrific catastrophe and the protagonist's defeat. In "The Pit and the Pendulum" we are shown a counterweight to the horror, where suddenly "the Inquisition [is] in the hands of its enemies." The turnabout is presented without elaboration, in a single brief and rapid paragraph, as if it has somehow been arranged for the personal salvation of the narrator. The "outstretched arm" that catches his own is that of "General LaSalle," and we are given virtually no further information beyond that of the French Army having entered Toledo and deposed the Inquisition.
It's like a supernatural intervention. Somehow the "fiery walls" of the chamber are destroyed—without any harm to the narrator—and after the slow and demonic torture to which he's been subjected, he's been instantly saved. Furthermore, his rescuer is the leader of the liberating army, seemingly saving him personally.
Is this an ending Poe simply tacked on because he couldn't think of anything other option, any more legitimate way to end the story? We have no way of knowing. But the utter strangeness of this reversal is in keeping with the nightmarish surrealism of the whole narrative. It makes no less sense than anything...
else in the story that General LaSalle's forces would miraculously appear and destroy the torture chamber and its deadly pendulum. Perhaps, as with the works in general of Poe, and of his contemporary Hawthorne as well, the outcome merely reinforces our overall impression of a dream, of events in which reality and fantasy are indistinguishable, merged into one.