"Malaysia won't succeed if the non-Muslims do not have the same opportunity,” Obama said in a townhall meeting for Asean youths at Dewan Tunku Cancelor in University of Malaya in Kuala Lumpur today.
Obama said non-Muslims in Malaysia are currently facing hostility, and some have felt oppressed.
"There shouldn't be reason to discriminate, and you have to make sure that you are speaking out against this in daily life.
And as you emerge as leaders, you should be on the side of politics that brings people together rather than drive them apart," Obama said to cheers from the crowd.
Obama said this today when answering a question from a Myanmar youth on factors of cooperation that can bring Asean together given its diversity.
He pointed out that the biggest source of conflict and war and hardship throughout the world was due to people treating those who were not like them differently.
He said the situation in Myanmar right now was that the country was going through a transition after decades of oppressive government, and it was now trying to open things up, which he said is to be lauded.
"However, the danger now that they are democratising, is that there will be groups inside Myanmar that might organise themselves politically around religious or ethnic identities instead of principles of justice or rule of law and democracy.
And you can actually see conflict that would move Myanmar in a bad direction," he said, adding that one of the problems in Myanmar was that the rights of its minority Muslim community were not protected.
Obama then added that the situation was not unique to Myanmar, and that in Malaysia, which had a majority Muslim population, there were instances where those who were not Muslims found themselves experiencing hostility.
He also said that even in the US, historically, the biggest conflicts arose around race, but over the course of generations the situation had improved, to the point that he could be elected as a president.
"All of us have within us biasness and prejudices against people who are not like us or people who are not raised in the same faith or come from different backgrounds, but the world is shrinking and getting smaller.
"You could think that way when living separately in villages and tribes and did not have contact with each other.
“But with the internet and smartphones, cultures all colliding, no country is going to succeed if part of its population is sidelined and being discriminated against," he added.
He then went on to say that similarly, Malaysia would also not succeed if non-Muslims were not given the opportunity, while the same would happen in Myanmar if the Muslim population was oppressed.
"Malaysia won't succeed if non-muslims don't have equal opportunity, Myanmar won’t succeed if the muslim population is oppressed.
"No society is going to succeed if half your population made up of women are not getting the same education and employment opportunities as men too," he added.
As such, he called on youths to embrace culture and be proud of who they were, while also appreciating differences in languages, food and how differently one worshipped God, adding that these were things to be proud of and not a tool to look down on a person.
He also called on the new generation to stand in "other people's shoes and look at things through their eyes".
Obama said that almost every religion teaches the basic principle of "do unto others as you want others to do unto you" and to "treat people the way you want to be treated".
"And if you are not doing that, then we are going backwards instead of going forward and this is true for all over the world," he told the 700-strong crowd of youths and civil society representatives