The grammatical phenomenon here is called referentiality: the article (or its absence) marks whether one refers to
- One certain thing or person, which has been introduced in the context (definite): the pupil / der Schüler "Der Schüler ging dann mit Kopfschmerzen nach Hause."
- One certain thing or person, which has not been introduced in the context yet (indefinite): a pupil / ein Schüler "Ein Schüler beklagte sich bei seinem Lehrer über Kopfschmerzen."
- A whole class of things or people, without having a certain item in mind (general): pupils / Schüler "Schüler mit Kopfschmerzen dürfen nach Hause gehen."
- A hypothetical instance of such a class (non-referential): a pupil / ein Schüler "Ein Schüler mit Kopfschmerzen darf nach Hause gehen."
As you can see, not all these cases are clearly different from each other, neither in English, nor in German. So, one has to go back to the meaning of the sentence to find out.
In your example, "Er ist ein Schüler und ein Lehrer." would be non-referential, "Er ist Schüler und Lehrer." would be general. Both is correct, and the difference in meaning wouldn't probably matter in the context.
However, if you want to give the profession of a person, you'd normally use "Er ist Lehrer". But this is not only for professions, since you could also say "Er ist Vater."
O. R. Mapper raised the point in a comment that the example for the general reference is plural, while the others are singular. This is a good point, because it seems that you need to use the plural for general references if you want to use them as the subject of a sentence. In the example "Er ist Schüler und Lehrer", the general references are used as predicates for "Er", and seem to have to agree in number with the subject.