Journals in general serve to curate an ever-increasing body of research and provide a crude method of gauging scientific quality, relevance to your field, and importance. They provide a crude method of judging the impact of scholars without having to read every single paper ever published.
Publishers specifically put in grunt work to make the curation process function. That means hiring people to coordinate the peer review process, identifying new fields that are in need of new journals to help disciplines form and mature, ensuring standards of the scientific method are being followed, and of course there's the commodity service of hosting digital content.
I think a more interesting question is how much the role of a publisher is worth (as opposed to whether it should not exist), and whether there are ways to fill the same role with a cheaper alternative.