WASHINGTON - Senator Arlen Specter, a liberal Pennsylvania Republican who had long chafed against his party's rightward drift, announced yesterday that he would switch allegiances and join the Democrats to strengthen his prospects for reelection next year.