Foreign nationals cannot own land in Thailand as freehold. The most common practice for foreigners buying house and land in Thailand is to do a leasehold structure of a maximum of 30 years with the landlord.
This is a watertight contract that is given by the local land office and the foreign national can then technically own the land for that period of time.
The lease can also be extended by two terms of 30 years each, giving the lessee a total of 90 years. This has to be a separate contract between landlord and lessee.
Should you wish to sell the land and house in future before the leasehold term expires, you may do so freely to a Thai or foreign national.
It is up to the landlord to sign the freehold land transfer to the Thai buyer or accept a new term of 30 year lease if it is a foreign national who wishes to apply for a new leasehold term of 30 years.
The foreigner purchasing from you can also simply take over the existing leasehold term if they wish. Meaning if you have owned the property for 5 years, the buyer will be taking over the remaining 25 years of the leasehold term. Even though foreign nationals may not own land, the building itself can be owned outright by a foreigner.