Is it true that if your apartment building is sold that the new landlord can evict you…?
…for any old reason after your lease is up? This is to say that the tenents residing there are not part of the new owners plans.
Pennsylvania
Answers below in Comments Section

Depends on the council, city or state rule. But if you do no make your payment on-time, then a default party is subject to an eviction, by court order.
The new owner has to follow the terms of the lease that are currently in place. However, when the lease is up, they can choose not to renew it — just as your old landlord had the right not to renew it. It’s a business decision.
As long as you are still under your lease you are safe, but after it is up they have the right to choose not to renew it as do you.
Don’t know about Penn.. but usually once they buy the property can boot someone out for them or a family member to live in the unit.
Once your lease is up landlords usually have to give you 30-60 days notice when asking you to vacate. Look into your local Renter Rights branch & see what they say.