You can create separate rectangular shape and use it as a mask and border for the image.
Create rectangular shape, be sure it is above the image. Select the shape and the image, and use Object > Clipping Mask > Make command (Cmd+7 / Ctrl+7)
Then you have to select the mask (rectangular frame) only using 'Direct Selection' and choose color and weight in the Stroke panel.
Also it is possible to create a border without adding new objects but using effects in Appearance panel.
In this way we need to use 'Add new stroke' button in Appearance panel. Then select this Stroke in the panel and click on 'Fx' button there, find in the list and add Convert to shape > Rectangle effect. In effect options just use 'Relative' size instead of 'absolute' values.
I'm not sure that this way is easier But it also works
How to use the Appearance panel to add stroke step-by step (as described by @Andrey Kozyakov above:
when I change the image to a rectangle it disapears...
Please show your artwork with appearance panel open.
An easier way:
Three steps: use the Rectangle tool in the task toolbar.
Deselect the "fill".