The country's capital, Antananarivo was filled with worshippers waving yellow and white 'Vatican' flags, many of whom had camped out over night to see the Catholic leader.
Catholics make up 35 percent of Madagascar's population of 26 million people.
Addressing the crowd, the Pontiff spoke out against "practices that lead to the culture of privilege and exclusion", and condemned those who "abused the name of God" to justify acts of murder and violence.
Referencing Luke's gospel, he said: ""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: favouritism, patronage and - as a consequence - corruption".
"The Master demands that we see beyond this. He says this clearly: anyone incapable of seeing others as brothers or sisters, of showing sensitivity to their lives and situations regardless of their family, cultural or social background 'cannot be my disciple' His devoted love is a free gift given to all and meant for all."
Pope Francis concluded his homily with a prayer: "May this humble realism - it is a realism, a Christian realism - inspire us to take on great challenges and give you the desire to make your beautiful country a place where the Gospel becomes life, and where life is for the greater glory of God.
The Pontiff's visit comes as the second part of a three-leg African tour. He has already been to Mozambique and will finish his trip in Mauritius.
Stay up to date with the latest news stories from a Christian perspective. Sign up to our daily newsletter and receive more stories like this straight to your inbox every morning.