When these verbs (DECLARE, ELECT, SWEAR, MAKE, etc.) are used in this way and the post is unique, you can leave out THE.
Here are some examples in the OALD:
He was sworn in as president.
We chose Phil McSweeney as/for chairperson.
to be made president of the students' union
But it is grammatical to add THE.