Defaulted card

Had a card defaulted several years ago, they closed it out and sold the debt to another agency, is that legal? If I do pay it off, will it erase the defaulted loan as well or will it still be a ding on my credit history?