If Nettie Colburn Maynard’s autobiography is accurate, that is what happened.
The Lincolns were known to conduct seances in the White House.
Any Spirit contacted in such a process is demonic, unless it was the spirit of Samuel or something - and even then we don’t know if that was him, or a demon.
The Old Testament penalty for necromancy was death - which indicates how dangerous that practice is.
Mary Todd Lincoln certainly practiced it. Lincoln is quoted as saying, “well for those who practice that thing, it would be the sort of thing that they like.” So, I don’t think he did.