Primarily, the soliloquies in Shakespeare's Macbeth and seemingly in his other plays, is to give the audience the opportunity to hear what is going on in a character's mind. We cannot read it on a page, so we must listen to it in the drama.
In Macbeth we hear several, most from Macbeth, though Lady Macbeth has something like a soliloquy in her sleepwalking scene. Often we gain insights into characters from what they say to other characters and how other characters react to them. In this way, however, the thoughts that are shared are private, where no one else but the audience hears them. In either case, it is for the benefit of the audience, which receives important information to better understand the character's actions and provides important elements that drive the plot. The soliloquy is...
...a device often used in drama where by a character relates... thoughts and feelings to him...self and to the audience [only].