Salman Hameed in The Express Tribune:
Here is the recipe: You take two stars that are orbiting each other. This is not as hard as it seems. Nearly half of all stars in our own Galaxy have at least one other star in its system. But make sure that both of these stars are at least 10 times bigger than our Sun. Then wait about 10 million years. This is the average lifetime of big stars. They will eventually exhaust all their fuel and explode in their individual supernovae. All that will be left of them will be their cores, called neutron stars. These are some of the strangest objects in the universe. Each of the neutron star contains mass equal to that of our Sun, but all packed in a size no greater than a city like Karachi. This means that they have very high density. A teaspoon of neutron star material would weigh as much as a mountain. Now you have two of these neutron stars orbiting each other. But orbits for such exotic objects are unstable. The two stars will eventually collide with each other — and this collision will result in the creation of gold and other rare elements.
However, in an act of ultimate charity, these elements are spread into the surrounding space.
By the time our Solar system was born, many such collisions had enriched our Galaxy with gold (and other elements). The gas cloud that formed the Sun and the Earth already contained these elements. Some of this gold became part of the Earth. Four-and-a-half billion years later, this rare element caught the attention of bipedal species and it became an object of desire and envy.
More here.