The Royal Bodyguard sees Sir David's character accidentally promoted to the role despite previously only working in the Buckingham Palace car park.
The series begins production in July.
It will be the 71-year-old's first comedy role since Only Fools and Horses ended in 1991, although Christmas specials continued until 2003.
Sir David has since been known for his drama work, including starring as police detective Jack Frost in ITV's A Touch of Frost.
"I am really looking forward to working on a great comedy project with the BBC. It will be good to have a laugh again," the actor said.
BBC One controller Danny Cohen, who commissioned the show, said: "I am absolutely delighted to welcome David Jason back to a leading comedy role on BBC One.
"David is a hugely talented performer and much loved by British viewers."
The Royal Bodyguard is being made by Hat Trick Productions and is written by The Worst Week Of My Life creators Mark Bussell and Justin Sbresni.
This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.