He warned that such actions were distorting people's understanding of complex issues, and spreading misinformation.
"All of us in leadership have to find ways in which we can recreate a common space on the internet," he said.
Mr Obama was quizzed by Prince Harry on BBC Radio 4's Today programme.
Prince Harry, fifth in line to the throne, is one of several prominent figures who are guest-editing the programme over the Christmas period.
Obama on the extremes of social media
The former president expressed concern about a future where facts are discarded and people only read and listen to things that reinforce their own views.
"One of the dangers of the internet is that people can have entirely different realities. They can be cocooned in information that reinforces their current biases.
"The question has to do with how do we harness this technology in a way that allows a multiplicity of voices, allows a diversity of views, but doesn't lead to a Balkanisation of society and allows ways of finding common ground," he said.
Mr Obama's successor Donald Trump is a prolific user of Twitter, but Mr Obama did not mention him by name.