Charles and Camilla will join the residents of Albert Square for a street party held in honour of the monarch's 70 years on the throne.
They filmed the scenes in March when they visited the soap's Elstree set and met members of the cast.
The episode is due to air on BBC One on 2 June.
Viewers of the soap will have already seen Mick Carter, played by Danny Dyer, decide to throw a jubilee party for residents of the square - he will later tease that some very special guests will be in attendance.
In the jubilee episode, the partygoers will be left in shock when the royals appear.
Charles and Camilla will be greeted by Mick and Linda Carter, played by Kellie Bright, who will introduce them to the residents of Walford.
Speaking about meeting the royal couple, Bright said they had been "amazing sports".
"I just thought, 'wow, they've never done anything like this before'. They didn't really know what to expect, I mean it must have been nerve-wracking for them and completely out of their norm," she said.
"So I just hope they enjoyed it as much as we did."
Executive producer Chris Clenshaw said the show was "truly honoured" to have Charles and Camilla make an appearance in "one of EastEnders' most special episodes".
"Linda Carter is naturally in her element and giddy with excitement as their royal highnesses arrive in Walford, but it wasn't just her, as for all of us at EastEnders it was an extremely special day that will go down in EastEnders' history," he said.