To play by ear is to learn a piece of music (or, by extension, an instrument) by simply hearing it over and over again. A number of musicians, many of them self-taught, began their music education in this manner; it's often an invaluable way to learn the mechanics of song and chord structure. Ever sat down at a piano and picked out "Twinkle, Twinkle Little Star"? Or what about grabbing a guitar and suddenly stumbling into the opening licks of Deep Purple's "Smoke on the Water" or Nirvana's "Smells Like Teen Spirit"? If you have, you can play by ear. It's an unbelievably common practice, even among non-musicians who just peck around at an instrument if it happens to be in the room. Even classically trained musicians that have spent their lives learning to read music are sometimes encouraged to play by ear; it's a technique that hones that inherent musical sense found in so many thriving musicians.
A great number of self-taught musicians started their training by learning to play by ear. Instead of picking up a book or taking lessons, they just slowly picked out the chords of a song until the entire thing was mastered. Then they moved on to another song. And another. Gradually, they learned their instrument just by their ability to play by ear; each song presented a new chord or a new technique to figure out and conquer. It's a method used mostly by popular musicians, particularly rock musicians who learned the nuances of composition and performance simply by knowing how to play by ear.
Though classical musicians are generally educated based on tons of music theory and sight reading, some methods tout the benefits of knowing how to play by ear. The Suzuki method of musical training, for instance, espouses the idea that learning music is the same as learning a language; it's acquired by years of hearing it coupled with formal training. Just like we pick up our language by listening to our parents and subsequently attending school, the Suzuki method teaches young children to play by ear before they begin formal training. The Suzuki school of thought on learning how to play by ear has proven to be fairly effective, but it is sometimes considered harmful as the children progress in their education; to play by ear at such an early age (and long before formal training) has the potential to damage the child's ability to actually read music instead of just picking out the notes or melodies.