The Duke and Duchess of Sussex also attended the Young Leaders awards ceremony, where Sir Lenny Henry and Olympic boxer Nicola Adams were among the guests.
In a speech, Harry said it was “heartening” to meet people on the programme from across the Commonwealth, who are tackling issues including mental health problems, gender equality, food scarcity and climate change.
“You are the hope and optimism the world needs and we will all do everything that we can to support you in it,” he added.
He and Meghan met a group from Australia, New Zealand and Tonga at the event ahead of their royal tour to the Pacific countries later this year.
It come after Meghan’s father reportedly criticised the Queen for agreeing to meet US President Donald Trump before him.
Thomas Markle told TMZ: “If the Queen is willing to meet our arrogant, ignorant, and insensitive president she has no excuse not to meet me, I’m nowhere near as bad.”
The US ambassador to the UK told Sky News that Mr Trump is due to meet the Queen when he visits Britain on 13 July.
At Buckingham Palace, Beckham spent the evening chatting with the young leaders and posing for selfies with them.
The former England and Manchester United footballer said he had been “honoured” to work with the programme for the last three years.
“Meeting the children and young people today and the insight into their lives and what they have done at such a young age is incredible,” Beckham said.
“They have all got amazing stories and to sit with them and actually speak to them about their programmes and what they want to achieve, it’s incredible to hear.”
Comedian Sir Lenny, who was knighted by the Queen in 2015, said: “It’s been an incredible and impressive day.
“These are people who of their own volition decided to become Commonwealth leaders and get involved in issues like food scarcity, gender abuse and mental health issues – that’s fantastic.”