French Interior Minister Gerald Darmanin condemned Italy's “unacceptable behaviour” in refusing to let 234 people dock at its shores.
The passengers on board the ship Ocean Viking will instead be allowed to disembark at a military base in southern France.
France retaliated by backing down on a promise to take in thousands of migrants from Italy.
Border security will be increased in the coming hours and Italy's stance will have consequences for its relations with France, Mr Darmanin said.
“France deeply regrets that Italy was not willing to behave like a responsible European state,” he said after a Cabinet meeting on Thursday.
“In this context, France decided on an exceptional basis to make up for the Italian government's unacceptable behaviour and to invite the ship to come to the military port of Toulon.”
SOS Mediterranee, the charity that operates the ship, said some of its passengers had been on board for more than two weeks.
It said passengers were in poor physical and mental health after being rescued from flimsy and overcrowded boats in the Mediterranean.
“Some people are sick, there are women and children,” said one passenger from Mali while being filmed by charity workers.
Mr Darmanin said they would receive all necessary medical care after arriving in France.
The standoff was an early test for Italian Prime Minister Giorgia Meloni on an issue that has long bedevilled European politics.
Her right-wing coalition came to power last month after campaigning in September's general election to curb illegal migration.
Italy wants its neighbours to share the burden of migrants arriving via the Mediterranean Sea from North Africa.
Ms Meloni spoke this week of a “migration emergency which, until now, has been borne by Italy and few other Mediterranean countries”.
Other states should co-operate with “countries that are most exposed due to their geographical position … to manage the migration phenomenon, which is now of momentous proportions,” she said.
Under France's EU presidency, more than 20 countries adopted a voluntary pact in June to ease the pressure on countries such as Italy.
However, Mr Darmanin said on Thursday that a French offer to take in 3,500 migrants was no longer on the table and that other countries should follow suit.
Mr Darmanin, considered a possible candidate for the French presidency in 2027, has proposed various measures to clamp down on illegal migration.
He last week revived proposals that had been shelved in the summer to speed up deportations for illegal migrants.
“If I had to summarise, I would say that we must now be mean to the bad guys and nice to the good ones,” he said.