Why did authors such as E. A. Poe and Nathaniel Hawthorne incorporate supernatural elements in their writing?
Remember that Romanticism arose as a movement that in many ways was a backlash against the idea of man's progress and the inexorable focus on scientific advancement and man's reason. One emphasis of Romanticism therefore was a focus on the limits of man's knowledge - on how much we actually haven't worked out with our reason and how little we really know. The supernatural clearly fits into this as we are not able to describe or understand its many manifestations.
In his great angst over being related to a judge involved in the Salem Witchcraft trials, Nathaniel Hawthorne, like other writers such as Herman Melville and Edgar Allan Poe, explored the supernatural and the preternaturnal which effected rationally inexplicable occurrences by interacting with man.
In his monumental novel, "Moby Dick," Melville's Captain Ahab seeks the great white whale, an unnatural creature, in order "to break through the pasteboard mask of nature" and understand what forces act upon man. Hawthorne explored the Puritan codes and the Calvinist-Puritan rivalry in his effort to explore the Puritan inclination to credit manifestations of the spiritual as witchcraft and evil. Unquestionably, sin and guilt preoccupied Hawthorne, two elements of the spiritual world and man. Like Melville, he,too, sought to break through the "pasteboard mask."
Certainly, Edgar Allan Poe explored the dangerous and dark regions of psychological terror and the many preternatural and supernatural forces that contribute to these regions. As a dark Romantic like Melville and Hawthorne, he rejected the optimism of his predecessors and sought for more realism. And, in his efforts to understand the workings of the human mind, Poe explored regions spiritual just as Hawthorne did. Like Hawthorne, Poe perceived the spiritual turmoil within people, a turmoil that wrought often aberrrant actions as in many of Poe's stories such as "The Black Cat" and "The Tell-Tale Heart," or secret sins within the hearts of man as in Hawthorne's "The Scarlet Letter" and "The Minister's Black Veil."
I agree with pohnpei397's comments and want to add that the Romantics were also generally very interesting in understanding the world in ways that were not strictly rational and scientific. Romanticism is often defined as the antithesis of Classicism (or the Enlightenment), and one characteristic of Romanticism is a strong interest in the irrational, the supernatural, and (to use Freudian terms) the repressed. These interests come out more clearly in the Dark Romantics, as they are sometimes called -- such as Edgar Allan Poe and Nathaniel Hawthorne. These interests are generally much less obvious in the earlier American Romantics such as Ralph Waldo Emerson, David Thoreau, and Walt Whitman.
The links below have something to say about Romanticism and irrationality.
They did this because they were writers from the Romantic movement in literature. This movement emphasized, among other things, the supernatural.
The Romantics liked to emphasize emotions (and especially emotions of awe and fear) rather than reason and they tended to believe in a kind of pantheism where there are lots of gods and things other than people have souls. Both of these ideas go well with supernatural elements.
If everything has a soul (even trees and such) then supernatural events are likely to happen. In addition, the supernatural, almost by definition, scares and awes us.
So, I think they put these elements in their writing because they believed in pantheism to some extent and because they wanted to write about strong emotions.