As noted in the other answer, the reason Shakespeare uses poetry for some characters and prose for others is based on social class. Prose mimics the "rougher" speech of the lower classes. Upper class humans, such as royals, speak in poetry to show their higher levels of education and refinement.
The upper class human characters not only speak in rhyme, they speak in iambic pentameter. This is a verse form consisting of five iambs (ten syllables) per line, with the stress falling on the second syllable. When their speeches become more passionate, they tend to end in rhyming couplets, such as when Helena talks about love:
Love looks not with the eyes, but with the mind;
And therefore is wing'd Cupid painted blind
The fairies also speak with a specific poetic rhythm all their own. This distinguishes them both from upper class and lower class humans. They speak in trochaic tetrameter, meaning their lines are shorter (only eight syllables) and the stress falls on the first, not the second syllable.
Shakespeare has his characters speak in prose when they are of the lower social classes. You will notice that all of the "mechanicals" - Bottom, Quince, Snout, Snug, Flute, Starvling - all speak in prose. It is partly Shakespeare's way of showing that these characters are not sophisticated or educated. They are rooted in the mundane, the ordinary; the "prosaic," if you will. Poetry is heightened speech, the language of love and philosophy and great drama, and these characters tread upon the ground.
By contrast, the men and women of the court all speak in verse. This is appropriate to their status as upper-class characters, whose discourse is about more high-minded things.
However, it is also important that you see that frequently Shakespeare has characters (such as Puck and the Fairy) speak in a verse which is more song-like, in eight-syllable lines instead of the ten of iambic pentameter. This is to suggest the fanciful, folk-tale like quality of the fairy world.