The 25-year-old actor, who reprises his role as Finn in the popular sci-fi franchise's next, had been dropping hints about the royals' cameo in the film since August.
During The Hollywood Reporter's Actor Roundtable, Boyega revealed that he features in a scene with both William and Harry, along with actor Tom Hardy, with them "wrapped in Stormtroopers costumes" for a "strange contrast of a weird family".
The actor added, "It's the best of both worlds for me."
Singer-songwriter Gary Barlow, who earlier denied that he was playing the role, also stars in the eighth chapter of the series as another Stormtrooper guarding Boyega's character in an elevator.
'The Last Jedi' is scheduled to be released on December 15.