When your computer writes things to your hard drives, it doesn't necessarily put them in any logical place, it just sticks them where they will fit.
A defragment of the hard drives takes all those bits of files that are all over the places, and orders them neatly. If you've done a lot of writes to your disk, and installed lots of things and never defragg'ed it, you can get a fairly noticeable difference in performance by doing it.
It's an option you can get to in Windows Explorer, under Properties (when you right click the hard drive you want to defrag).
Honestly, it doesn't do that much unless you treat your hard drive very poorly. But there's absolutely no harm in doing it anyway - it can just take a long time.