In the Longman Student Grammar of Spoken and Written English, we read:
When a predicative noun phrase names a unique role or job, either a zero article or the is used.
Custom and convention in English are to use the zero article before predicative nouns after verbs like elect and appoint, and other verbs when the meaning of the verb is the assumption of an elective office, named position within an organization, or other clearly defined role. In these cases, the name of the role is treated almost as if it were a proper noun. For instance:
- He was elected President
- She was made CEO of the corporation
- He was appointed chairman of the commission
- She was proclaimed Queen
- She became Speaker of the House
- I will take the child as ward
As is sometimes the case in English (as in any language!) there is no "grammatical" explanation for this custom. There are many common English expressions in which the zero article is used, and there is no "rule" that can be applied to determine where the zero article is expected and where it is not. See for instance:
- He was taken prisoner
- She is chef, owner, and head dishwasher
- He took office
1Can you add more context? Your example seems to be shortened at best. Your meaning may be like "Trump was elected (to become) President." Anyway, titles tend to follow conventional usage rather than hard rules. – user3169 – 2017-07-03T05:01:54.297
In that answer, did I use the phrase "a general position"? No. Did I use the word "role" multiple times? Yes. You must get your head around the concept of "role". When we say "he was elected president" we mean that voters wanted him to assume the role of president, to occupy the presidency. – Tᴚoɯɐuo – 2017-07-03T12:21:45.740