If you wanted to add a border only to a selection and not the complete image, then you should read this other post BorderToSelection
To add a border to an image in GIMP, open the image first (make it the active window).
I chose the above figure because.. well.. I don’t know.. I just did
Now click on Filters->Decor->Add Border…
Choose the width of the border horizontally and vertically. The Delta value of the colour determines how “3-D” the border appears. Experiment with it till you’re satisfied and then press OK
Voilà! There you have it. The image has a border now.