I understand the church following its own teachings, but I don't see what this has to do with employment.
The church is welcome to condemn same sex marriage, but I don't think a fair argument can be made that this teacher was any less qualified to teach his subject because he happens to go against church teaching.
Catholic schools are there to teach students about their religion in a way that public schools in the US can't, but that doesn't mean they should be allowed to discriminate in employment. This goes beyond how far I think religious freedom extends.
I agree with this. The idea that absolutely everyone working at a catholic school must live a life completely in accordance with catholic teachings is moronic. Would you fire teachers if they didn't want to sign a pledge guaranteeing that the only contraception they use is abstention?