Probably the easiest way to do this in versions of Word later than 2007 is to create a table with one cell and fit the image into the table. Check the width of the image on the Picture Tools Format tab.
Click on the image, and then on the Insert tab, select Table and then Convert Text to Table…
Word will wrap a table around that image. Now go into Properties on the Table Layout tab and set the table to the exact width as the image. You might also want to center the table. Next click on Options and set the Default cell margins to zero inches.
To place a top and bottom border, use the Borders and Shading dialog box. You could have alternatively skipped the table and applied borders to the Paragraph with the image in it, but then you’d have to fiddle with the margins because the borders wouldn’t be the exact width as the image.
When the dialog box opens, make sure you select Cell in the Apply to: section. Select the color and width you want and click on the top and bottom edges in the Preview screen.
When you click OK, this will be the result. (I changed the color to bright pink to make the border more visible.) The border is exactly the same width as the image.