Queen Elizabeth II dies — follow the latest news as the world mourns
The brothers have reportedly fallen out in the years since Harry left front-line royal duties for a life in the US with his young family.
But on Saturday, all four put aside their differences to view floral tributes to Queen Elizabeth II that have been placed outside Windsor Castle, about 35 kilometres west of London.
They also met members of the public who were there to lay flowers and mourn the queen.
For William and Kate, the Windsor walkabout was their first public engagement since becoming Prince and Princess of Wales.
A royal source said the Prince of Wales had asked his brother and his wife to join them in viewing the tributes.
The last time William was joined in public by his brother at Windsor Castle was at the funeral of the Duke of Edinburgh in April last year.
Both couples left in the same vehicle as Saturday's engagement, which lasted more than 40 minutes, came to a close.
All four were dressed in black as they walked along the gates of the castle.
At one point during the walkabout, Meghan was seen being given a close hug by a young girl in the crowd.
The duke and duchess held hands as they looked at the tributes, with Harry at one point affectionately putting his hand on Meghan's back.
Each member of the royal family was seen pointing at different tributes and discussing them as members of the crowd waved at them.
William and Kate and Harry and Meghan then greeted well-wishers at Windsor Castle, with a number holding up mobile phones to take a photo of the royals.
A crowd at the castle broke out into applause as the couples approached members of the public and spoke to them.
William was seen speaking intently to a member of the crowd, at one point shaking a woman's hand. Both William and Kate could be seen thanking people.
Kate crouched down at one moment and began speaking to a child who had started to cry.
The child stopped crying when Kate approached her.
Meghan was also seen shaking the hands of several children and well-wishers at Windsor.
She walked over to a section of the crowd and approached a teenager, who was seen putting her hand over her mouth in shock.
The duchess and her husband spoke briefly for a few moments and Meghan could be seen assuring a young girl by putting her hand on her shoulder.
The girl then said: “Can I have a hug?” and Meghan was seen nodding, before leaning in and giving her a big hug.
The touching moment was filmed by other members in the crowd.
The duke and duchess were handed bunches of flowers, which they both accepted.