Shakespeare wanted the three witches to waylay Macbeth and Banquo on the road to Forres and tell the two warriors what they tell them in Act 1, Scene 3, the gist of which is:
THIRD WITCH: All hail, Macbeth, that shalt be King hereafter!
THIRD WITCH: Thou [Banquo] shalt get kings, though thou be none.
So all hail, Macbeth and Banquo!
But the poet wanted to introduce the witches in a separate scene in order to establish that they were supernatural creatures with "more in them than mortal knowledge." He did not want to introduce the crazy hags in Scene 3 because neither the audience nor Macbeth and Banquo would have any idea who or what they are. Although Macbeth and Banquo are unacquainted with these strange creatures, at least the audience knows they are witches who have planned to meet with Macbeth. Up until Scene 3 we haven't even met Macbeth and Banquo. The poet knew he could not introduce five characters all at once without creating confusion.
Shakespeare does something similar in Hamlet. He wants to have the dead king's ghost (another supernatural creature) tell his son that he was murdered by Claudius. But the poet knew he couldn't have the Ghost suddenly materialize in front of his son and start telling him what happened in the garden. Hamlet might think he was having hallucinations. Shakespeare had to take pains to establish that the bearded actor wearing armor who appears in Act 1, Scene 1 is indeed the ghost of King Hamlet. Then when Hamlet finally meets the Ghost in Scene 4 of that act, there is no need for the Ghost to introduce himself and explain his identity.
Since the appearance of King Hamlet's ghost is an attention-grabber, Shakespeare also uses it to quiet the audience and engage their curiosity right at the beginning of the play. The same is true of the three witches. They are good attention-grabbers. Shakespeare can introduce them and hook the audience's interest at the same time.
It is noteworthy that in both Macbeth and Hamlet there is intervening business between the first scene and the encounters with the witches and with the dead king's ghost, respectively. Macbeth and Banquo do not meet the witches until Scene 3, and Hamlet does not meet the Ghost until Scene 4. Shakespeare knew he would have the audience in suspense waiting to hear what the witches would say to Macbeth in the one play and waiting to hear what the Ghost would have to say to Hamlet in the other.
Act 1, Scene 1 of Macbeth has a strong impact on the audience, not only because the characters are so strange, but also because the scene is so brief. We see them in flashes of lightning and hear them through crashes of thunder--and then suddenly they are gone! All we have really learned is that they intend to meet with Macbeth.
As Shakespeare died 400 years ago and did not leave a written record explaining his motivations, we cannot know what went through his mind as he was writing Macbeth. Instead, we only have evidence that might enable us to discuss the literary techniques of the play or its possible effects on certain members of its audience.
The witches introduce an element of the supernatural into the play. The character of the witches is evil and ominous, creating a mood of terror and horror. As the original audience of the play would have been Christians who believed (1) that witchcraft was real and (2) that it was the work of the Devil, they would have found the witches even more ominous than a modern audience.
By foreshadowing several key plot elements the witches add a sense of inevitability to Macbeth's fate, or a sense that his fate is preordained. Finally, the witches function in the plot to fan the flames of Macbeth's ambition, setting the major events of the play in motion.