Dramatically, the play's opening with the witches is important for at least two reasons. The first is a practical one: Shakespeare has to get the attention of the groundlings, those attending the performance who are standing in the pit around the stage. These people paid the cheapest price for their tickets, so they stood for the entire performance. Before the play begins, people are milling about, talking, and some are selling food. The playwright must grab their attention to quiet this group so that everyone in the theater can hear the actors. The Elizabethans believed in the existence of witches; these in this play are particularly ugly witches so their appearance on the stage would definitely grab the audience's attention.
Secondly, the witches' comment, "Fair is foul, and foul is fair," sets up one of the most important themes of the play: appearances can be deceptive. The witches, furthermore, are evil; they would appear via the trap door in the floor of the stage, indicating their origin in the Underworld and their collaboration with the devil. King James had written a book about witches, too, so there was intense interest in them. The appearance of the three witches would be riveting to the audience, and their remarks in the opening scene prepare the audience for the deception that will appear throughout the play.
Opening the play with the darkness, thunder, and three witches stirring a cauldron produces a dramatic effect that would certainly have intrigued the superstitious Elizabethan audience. Moreover, since they were already interested in the supernatural, the Elizabethan audience would have responded to the motif of the waking world of reality being intermingled with the unnatural world as Macbeth falls under the spells of the witches. His later paranoid hallucinations--seeing daggers, the ghost of Banquo--and his and Lady Macbeth's insomnia are all effects of this blurring of reality and mystic.
Another result of opening with the scene of the witches is the introduction of the theme of moral choices vs. evil, a theme intrinsic to the play. For, it is because of the evil seductions of the predictions of the witches that he begins his course of evil: "If chance will have me King,why,/chance may crown me,/Without my stir" 9I,iii,144-146).
The witches set up the motif of "fair is foul, foul is fair" in the play and set Macbeth up with their predictions "all hail thane of Glamis, thane of Cawdor, and king hereafter." The supernatural element of the witches sets up the ambiguous tone as to why Macbeth proceeds in the manner of attaining the kingship. He is given the title Thane of Cawdor, and assumes the kingship will follow. Would he have been king without murdering Duncan? We will never know as he and Lady Macbeth take matters into their own hands, preferring to control the situation themselves and commit multiple murders to attain and keep the crown.
'Fair is foul and foul is fair' relates more directly to the reversal of fundamental values that the play deals with. The idea at the heart of this is that, for the witches, all that is good is evil and all that is evil, good. As the play progresses, we see this maxim being taken on first by Lade macbeth as she calls on the evil spirits to 'unsex' her and remove all the natural feelings of 'remorse' and affection and thereby render her a vessel of pure evil. Gradually, Macbeth too goes through this process, casting off his nobility etc in favour of evil.
Also remember Macbeth's first words n the play, 'So foul and fair a day I have not seen.' In giving Macbeth these words, shakespeare establishes a connection between him and the witches.