Answer
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
1- If you did not know that you had to pay Zakah on gold until after you had sold it, then there is nothing that you must do.
2- However, if you knew that you had to pay Zakah on it, then you should pay 2.5% per year.
The late Saudi scholar, Sheikh Ibn Baz (may Allah have mercy on him) stated:
If you did not know that you had to pay Zakah on gold until after you had sold it, then there is nothing that you must do.
However, if you knew that you had to pay Zakah on it, then you should pay 2.5% per year. You should pay that for each previous year according to the value of gold in the marketplace. You must pay 2.5% in cash.
However, if you did not know about that until the last year, then you should pay Zakah just for the last year.
Almighty Allah knows best.
Source: Islamic Fatawa Regarding Women, Compiled by Muhammad Ibn Abdul-Aziz Al-Musnad and translated by Jamal Al-Din Zarabozo, Darussalam, 1996.