Question: I have two different pictures of the same object, one of which is taken from roughy the same angle but has a different scale and rotation. I want both images to overlap so that the upper one matches the lower one as exactly as possible. Is there any option in gimp where I can define a number of key points and gimp aligns the images according to these points? For example I say that corner X in picture 1 has to match corner Y in picture 2. It should be sufficient to define 3 such points in each image to get a good result already.

If it is not possible, what would be the best way to reach this goal aside from just scaling and rotating until it looks ok?

Answer: 
I just did this in Gimp with no additional software. This method will easily and precisely produce the "3 point scale, rotate, translate" that you asked about. If there's other perspective issues though, one of the other methods in the other answers will be required.

1. Both images in their own layer. Select the ruler.
2. Show Layer1/Image1, measure between two points. Click and drag from one point to another, then zooom in and move the endpoints for more precision. This gives you the exact measurement to a tenth of a pixel and the rotation angle. The further apart the points, the better. Let's call it Length1.
3. Show Layer2/Image2. Adjust endpoints to match the same reference points. Let's call it Length2.
4. 100 \* (Length1/Length2) = The scale percentage you need to apply to Image2.
5. Rotate as needed, as indicated by the difference in rotation angles.
6. It's a simple matter to move one image over the other.
click file>>>open as layers>>>select both of the images that you want to merge.

click on the larger image, and click on the scale tool. Scale the larger image down to fit on the smaller image.

Set the top layer's opacity down to a lower number so you can see how the two are aligning, kind of like it's done in this gimp video tutorial on beer: <http://gimpedblog.blogspot.com/2011/12/in-this-gimp-tutorial-im-going-to-show.html>

use the move, rotate, and perspective tools to adjust the two photos into place.

crop the extra canvas area out with the crop tool.