Yes a landlord must legally give you at least 60 days notice that they are selling the rental property.
The landlord can legally sell the rental property or put the rental property up for sale at anytime to a potential buyer.
If the place you're renting is a house which is a single family home and the landlord wants to sell the house to someone they can do so at anytime.
But they also must give you notice about the sell and give you options to terminate the lease and move out if the new owners want to move in themselves.
However for an apartment you usually do not have to move out even after the sale as the new owner would likely want to keep the tenants.
The new landlord must stick to the conditions of your original lease until it expires before they can set new rules.