Well, there's something in the bible about it (presumably Leviticus? Certainly, Old Testament) which I imagine is the root of the Chasidic peyoth (which is what the side-locks are called) and what Rastafarians call the Nazarene Vow. There's some interesting reggae on the topic; that Morgan Heritage tune about how you don't have to have dreadlocks to be a rasta caused quite a fuss, and there's an Anthony B tune about how you must have locks (called Nazarene Vow, I think; the tune also covers not eating pork). It's a common theme in Linval Thompson's work (Don't Cut Off Your Dreadlocks, Long Long Dreadlocks etc), and there's many a tune about an unfortunate barber getting his comeuppance. I like it when reggae vests locks with occult powers: "Dread flash him locks and weakheart drop"; hair as a weapon. I guess the Bobo Ashanti angle of wrapping dreads in a turban is interesting too - I've no idea why this is done.
Didn't it used to be illegal to show your dreadlocks in Jamaica, hence (to some extent) the hats?
I'd always assumed that the prohibition on haircutting in some religions was to do with your hair having been granted to you by God, and therefore being sacred and not really yours to mess about with.
Incidentally while looking on Wikipedia for the correct name for Chasidic peyoth, I discovered that Chasidic boys' hair is kept long until the age of three, when it is cut ceremonially.
Sorry for long and formless post.