The new measure is intended to apply to Syrians and Eritreans who arrived in Italy after April 15th and are deemed to be in need of protection. A further 16,000 migrants who arrived in Greece from the two countries should also be relocated, the EU said.
If the scheme is successful, the 40,000 chosen refugees will over the next two years be relocated to 23 countries named by Brussels.
The European Commission said the chosen number represents approximately 40 percent of asylum seekers in clear need of protection who arrived in Italy and Greece last year.
The EU's migration commissioner, Dimitris Avramopoulos, said the figure was picked for both being helpful to Greece and Italy, while also agreeable to participating European nations.
Countries which agree to take in the Syrians and Eritreans will be offered €6,000 per person, with the greatest number to be moved to Germany.
Berlin has been asked to find homes for 5,258 people relocated from Italy, representing 21.91 percent of the total.
France has been allocated 4,051 refugees, followed by Spain's quota of 2,573 people.
The UK is notably absent from the measure, following the British government's vocal opposition to plans to relocate refugees.
London is however included in the EU's additional measure to resettle 20,000 refugees from outside Europe, part of a scheme aimed at stopping people taking the dangerous journey across the Mediterranean in order to seek asylum.
So far this year around 1,800 people are thought to have drowned during the journey, which has become the world's most dangerous route for refugees.
The EU's resettlement plan is intended to be rolled out over the next two years, with Brussels allocating €50 million in funds for the scheme until the end of 2016.
Again Germany is earmarked to take the largest number; 3,086 refugees or 15.43 percent of the total. France will be asked to resettle 2,375 people, with the UK requested to welcome 2,309 refugees.
Despite the high number of migrants arriving on Italian shores - up to 200,000 this year by government estimates - Rome has been asked to take in 1,989 people under the resettlement programme.
The figures for each country were calculated based on a number of areas, with population size and GDP being the main deciding factors. The number of refugees to be accepted was also lowered if a country either had a high unemployment rate or was already processing a high number of asylum applications.