Ouija boards do exist, but there is no scientific evidence that they really allow users to contact spirits. According to the Smithsonian, many psychologists and researchers believe that the users subconsciously move the planchette to make the boards work. This is called the ideometer effect, or unconscious movement.
The invention of the Ouija board came from the American spiritualism movement, which was popular in the 19th and early 20th centuries. There were various popular methods for supposedly allowing the spirits of the dead to communicate with the living, including calling out letters and listening for knocks to signal the right ones. The Ouija board, which was patented in 1891, offered a faster and simpler way to accomplish this spiritual communication.