There are two ways a tenancy can be ended if, in good faith, the buyer plans to occupy the unit or use the property for another purpose:
The buyer submits a written request to the seller to end the tenancy before taking possession of the property (service of notice cannot be a condition of sale). Then the seller (or existing landlord) gives the tenant a Two Month Notice to End Tenancy for Landlord’s Use of Property
Once the buyer takes possession of the property, they can serve a Two Month Notice to End Tenancy for Landlord’s Use of Property
Unless a landlord (seller or buyer) serves a proper notice to end tenancy, the tenancy continues under the terms of the original tenancy agreement.
Read about the Two Month Notice to End Tenancy for Landlord’s Use of Property