Characters need to be given voice to further their personality and believability. This is accomplished through voice acting, where actors design voices for these characters and use microphones to record it.
They speak dialogue reading from a script and improvising in the voice of the intended character. The director coaches them in the personality and the intended effect of the character. An actor must record lines several different ways the character could say that piece of dialogue.
Once the voice acting is complete, the characters are then animated to appear as if they are speaking to recorded dialogue. It is carefully animated in order to ensure there is a perfect sync between the character and the dialogue. Editors work hard to ensure the actor's best recordings are used and often mix and match different takes to create one perfect piece of dialogue.
I also found an interesting video documenting the voice talent for Toy Story 3, which I plan to use in my Major Work.