This is purple fringing and occurs either digitally during color-interpolation or optically when a lens does not focus all wave-lengths the same. The latter is generally known as chromatic aberration. It can be other colors than purple in that case.
In either case, you can correct the issue post-processing using chromatic aberration removal. Some cameras have that feature built-in which is quite effective but not perfect. It really depends on the model.
Adobe Lightroom, since version 4, offers a simple tool to remove this. You can even sample from the fringe to have it remove the exact color. I have used it and can say it works quite well.