C.D.
My daughter did this for almost a year and a half. She stopped before she turned two, I believe. I talked to her pediatrician and did research. While sometimes this can be a sign of a developmental issue, there are usually other signs that you are seeing as well that would be concerning (arm flapping, not responding to his name or other sounds, lining up toys in a rigid manner, etc) My ped said it was simply a way for my daughter to communicate that she was upset. Our daughter, now almost 4 years old, is very strong willed and gets frustrated easily, so head banging was simply part of her personality and temperament. I also read a study that said that children who bang their heads as toddlers are often very intelligent. We had our daughter assessed by a developmental pediatrician and psychologist just before she turned 3 and determined she has no disability (like autism or aspergers) and she tested as having "very high cognitive abilities."
So, while I would talk to your ped about it, I would not assume this is something to get overly worried about. You probably just have a really smart kiddo that is learning how to vent his frustrations. I think you are doing absolutely the right thing by ignoring it and making sure he is safe. Our doc told us that she couldn't really hurt herself anyway doing this.
Best wishes!