The Conservative MP said he spoke to the duke on the eve of his proposal being debated in the House of Commons as part of the Nationality and Borders Bill.
A spokesperson for Harry confirmed the sentiment shared by Mr Mercer was accurate and the pair were speaking veteran to veteran about issues they care about.
They added the duke supports the purpose and intent behind initiatives that better support servicemen in light of the sacrifices they have made for their countries.
He has contributed hugely to the veterans debate and I wanted his view
MP Johnny Mercer
Mr Mercer wants ministers to waive immigration fees for foreign and Commonwealth military personnel and their families who want to stay in the country once their service has ended.
They would be required to have served for a minimum of five years to be eligible under Mr Mercer’s proposal.
But MPs rejected his amendment by 296 votes to 251, majority 45.
The division list showed 15 Conservative MPs rebelled to support the proposal.
The Government has proposed that troops from non-UK nations who have served in the British armed forces for 12 years may be able to stay in the country for free.
In May, the Ministry of Defence (MoD) said there was a proposal to waive the £2,389 visa application fee for Commonwealth service personnel, in order to “recognise their contribution”.
Speaking in the Commons, Mr Mercer said: “I speak to all sorts of people in the veterans community – last night I had a conversation with Prince Harry about this.
“He has contributed hugely to the veterans debate and I wanted his view.
“He said to me it’s not only morally right but would mean so much to those who have given so much – and it’s not a political intervention, it is the moral purpose of this.
“It’s an almost effortless change, as he said, for this Government to make for us, to finally see through what we’ve said for these people for so long because we owe it to them.
“They’re our brothers and sisters, they’ve served with us over many, many years.”
Mr Mercer said he was told the Government could not implement his proposal to waive fees as it would cost £160 million, telling MPs: “That is garbage.”
On the 12-year eligibility criteria, he also said: “I don’t want to air dirty linen in public, but that 12-year figure, I was there when that was decided upon, it was done on a visit, it was plucked out of the air. There is no evidence whatsoever to back it up.”
Mr Mercer said there is evidence that non-UK personnel are likely to serve in the British forces for six to seven years, adding 12 years is “well beyond” what the UK’s allies do.
He said all the political parties will support the amendment “except the Conservatives”, adding: “We are the ones who made a promise that we would do something about that, and that is unconscionable.”
Mr Mercer advised MPs they were there to represent their constituents as he encouraged them to support his proposal.
He went on to highlight the case of a Fijian veteran in Plymouth who served for nine years and fought in Afghanistan and Iraq, but has a “£10,000 bill that they have to pay to stay in this country that they fought for over so many years”.
Mr Mercer asked MPs if they could “really look that family in the eye and say ‘no, you have to pay, we have to make a profit out of you for you to stay in this country, despite the fact that you were prepared to commit so much to the privileges and the freedoms we enjoy’.”
For the Government, Home Office minister Tom Pursglove said: “I would like to thank him and colleagues for raising these matters and I would like to invite members to meet with ministers along with the Royal British Legion next week to make sure the concerns and realities of non-UK service personnel … are fully understood.”
The minister also emphasised that the Government had set out measures to help Gurkha veterans over the summer.