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:
In his response to your question, Prof. Dr. Monzer Kahf, Professor of Islamic Finance and Economics at Qatar Faculty of Islamic Studies, states:
Buying a real estate property (land, building or land to build on) whether for renting or for sale is investment which makes such property “acquired for making return”. This is the proper definition of assets subject to Zakah in contract for “acquired for personal/family use.”
All properties fixed or mobile, real or personal that are acquired for making return are subject to Zakah (of course provided other conditions are fulfilled, e.g., the hawl on the original nisab and being freed from necessary commitments).
They are subject to Zakah regardless of whether they actually generate income or not or whether they are for sale or for other kinds of investments such as renting or in industry or other return-generating uses.
The market value of such properties should be estimated on the day when your Zakah is due and this value should be added to other investments, properties, cash, bank accounts, etc. and the Zakah due is 2.5% then and every lunar year afterword.
Please note that whatever rent or return generated by such real estate is not real estate, it is cash that, if it remains with you until the day of Zakah, is included under cash of bank accounts.
So, the rent as such is not subject to Zakah, what is subject to it is what remains of it, being cash, on the Zakah due date (i.e., after one lunar year, 354 days, after the day you acquired nisab for the first time and every 354 days then after).
There are other opinions but none of them maintains consistency within itself or compliance with the texts and their proper understanding.
This means for you the following: you have to calculate and pay Zakah on all past years (Zakah dues do not die out by passage of time) for all past years since you obtained this property on its market value on the day of your Zakah.
You should estimate that to the best of your knowledge. In the year you sold it, there is nothing to be paid or done but when the day of your Zakah comes here again you add together whatever you have for investment, cash and etc. as mentioned above and pay Zakah on the total.
Of course, if you bought a lot of land to build on it a house to live in, i.e., “acquired for personal of family use” such a lot is not subject to Zakah, so is the house you build and live in.
You should also remember the deductions from Zakatabe items; they are generally all “acquired for personal and family use” (naturally men golden jewelry are not included because they are not permissible, women jewelry has some details that are outside the scope of the present question). Of course, included in the exception is anything that is committed for any necessity such as debt payment, or expenses until next income is received.
Almighty Allah knows best.