Should I stay or should I go?

Hey, hoping for some help!
My fixed term contract came to an end earlier this month. I handed in my notice and found a new property which I am due to move into in the next fortnight. A replacement has been found for my current house, and the agency have provided my references for my new landlord.
Today I received an email to say the landlord of my current house is selling the property, and he served the whole house with their two months notice. The agency have now stated I can’t leave as planned and have to serve the two months, or if I do leave, the entire house will have to leave at the same time as we’re tied together.
I am confused why I was allowed to leave prior to the eviction notice being served but am now not able to based on being in a joint contract?
I’m in a situation where I either have to pay rent for both properties for two months, or risk losing my new house which is not ideal.
Any guidance would be much appreciated.

As you are on a periodic tenancy basis, all you need pay for is the full period of the month that you were going to leave in, no more, assuming the agent received your notice, which by implication they did.
To quote an authority on this: “However, when the tenancy is a periodic tenancy, the tenants’ position ‘at common law’ is that they can end the periodic tenancy on giving notice of one ‘period’ – which for most tenancies will be a month as most tenancies have a monthly rent.”
The tenancy agreement will confirm the notice period you have to give, and whether or not you pay a proportion of the month, if you leave before the end of the monthly period.
You also implied that you are living with others. If they all signed the same tenancy agreement that you did, then by giving notice, you (accidentally?) gave notice on behalf of all the signatories to the agreement that you signed, so none have to pay or stay for more than you do. If they did not sign your agreement, then that is their problem, not yours. Provided they leave within a month, they only need pay for that month - they don’t have to pay for the full two months if they too are on a periodic monthly tenancy and leave within the first ‘period’.