I told joe that the ghost hides in his closet
Why would you lie to Joe about that?
Because a few days ago he told me that he used a Ouija board.
It's wrong to intentionally scare a friend. This will be seen as cruel and unkind as it will leave your friend in a vulnerable state of mind.
You're right, I guess I should let him know I was just joking.
It would be great of you to ensure your friend that he has nothing to worry about. This will likely help him to sleep better at night if he has been having trouble.