If the three witches were a figment of Macbeth's own imagination, why was Banquo able to see them at the beginning of the play as well?
As per my comment, you are begging the question.
The fact that Shakespeare introduces the witches before having Macbeth meet them, and has Banquo seeing them, suggests that he wanted to establish that they are real, not figments of Macbeth's imagination.
Banquo. Were such things here as we do speak about? Or have we eaten on the insane root That takes the reason prisoner?
As to how they could have created a shared hallucination, the mutable nature of human memory is that, as we retrieve and discuss a memory, we store a slightly revised version with added "details" we've derived. This is one of the explanations for "false memories" such as has been found in abuse cases in psychology where trauma can put a person into a suggestible state where, when they are prompted for details, or have them suggested, they store them into a memory. It is possible that Macbeth was the one hallucinating, projecting his own ambitious thoughts, and as he described it to Banquo, dazed by the battle, Banquo stored these new "facts" into his memory of the situation.
Personally, as a fan of Shakespeare's works, and an occasional performer of them, I believe that the Witches are intended to be a real and continuing presence in the play rather than a hallucination.