Pope Francis spoke at an outdoor Mass in front of tens of thousands of people for World Youth Day.
He prayed Poles would have "the desire to leave behind all past wrongs and wounds, and to build fellowship for all, without ever yielding to the temptation to withdraw or to domineer."
His message is at odds with the right-wing conservative Catholic government which has not supported a refugee or migrant policy.
The pope is in Kraków for a week of celebrations with millions of young Catholics.
He also hailed Poland's native pope, St John Paul II as a powerful and meek herald of mercy.
The pontiff also praised the countless "ordinary yet remarkable people" who held firm to their Catholic faith throughout adversity in the former Communist-ruled nation.
Francis will have his first big meeting with the young faithful in a Kraków meadow on Thursday evening.
He also made an unscheduled stop at a clinic to visit and pray for comatose Cardinal Franciszek Macharski, an-89-year-old retired prelate who had been archbishop of Kraków.
World Youth Day is held every three years in a different country.
This is Pope Francis' first visit to Eastern Europe.