The pontiff has urged the crowd to build history "in complete respect for the earth and its gifts." Around 1 million people gathered to hear Francis say mass in the Malagasy capital.
Pope Francis on Sunday spoke out against "practices that lead to the culture of privilege and exclusion" and criticized those who consider family "the decisive criterion for what we consider right and good."
Around 1 million worshipers made their way to Soamandrakizay stadium in Madagascar's capital, Antananarivo, to hear the pope say mass on the second day of his weeklong tour of three African countries severely impacted by climate change.
"When 'family' becomes the decisive criterion for what we consider right and good, we end up justifying and even 'consecrating' practices that lead to the culture of privilege and exclusion: favoritism, patronage and, as a consequence, corruption," Francis said.
On Saturday evening thousands of young people gathered for a vigil in the capital during which Pope Francis praised the crowd's "joy and enthusiasm."
The leader of the Catholic Church encouraged the youth not to fall into "bitterness" or to lose hope, even when they lacked the "necessary minimum" to get by and when "educational opportunities were insufficient."
The vast majority of Madagascar's 25 million people live in poverty on an income of less than two dollars a day. More than half of its young people are out of work, despite many having good qualifications. Around 35% of Malagasy are Christian.
The last pope to visit Madagascar was Pope Saint John Paul II 30 years ago.
Pope Francis also visited the cyclone-vulnerable nation of Mozambique earlier in his African trip, and is due to travel to the island of Mauritius on Monday.
Climate change, corruption and poverty is on the agenda in talks with leaders.