Yes. Foreigners can legally buy property in Thailand. You can own units in a registered Condominium (Foreign Freehold or Leasehold), and you can buy a House, Villa or Apartment (Leasehold). Under Thai law foreign nationals are not allowed to own land in Thailand.
With regards to buying property in Thailand, Foreign Freehold ownership applies only to the purchase of Condominium unit(s) and means that as a foreigner you own the unit outright.
Leasehold ownership applies to any non-foreign freehold units in a condominium, or an apartment, house or villa – you buy the property on a lease basis which is 30 years.