In continental Europe, safety was a primary concern as Martin Schröder explained. For Germany, having gold on another continent is a way to make sure it could not easily fall in the hands of the Soviet Union.
But there are a few other good reasons to continue to store it abroad today. Compro01 mentioned the fact that some of this gold was probably purchased in the US and it would be very complicated to transport it back to Germany. But for gold stored in Germany, you would have the exact same problem when you want to sell it. So it makes more sense to keep gold close to where it can be bought and sold.
Finally, secure storage facilities do cost money. Even if you have to pay some foreign country for storage (traditionally it was not necessary but some countries now charge for it), it might still be cheaper than creating or enlarging your own vaults.
Note that this is mostly a hangover from past times. In spite of regular populists call to “keep our gold” in Germany, the real question is why bother with holding gold in the first place? Countries are mostly stuck with it for historical and emotional reasons and can't even offload it easily. The UK has actually tried to get rid of some of its gold some years ago, tanking the price in the process.