Anthem said it will buy Aspire Health, joining rivals by getting further into the business of providing medical care outside the hospital in the community.