The two sentences are subtly different.
If I'm to be a teacher... is a hypothetical statement about a possibility, intent, or expectation for the future. You could read it as being like "if I am intended to be a teacher..." or "if I am expected to become a teacher..." As such, it's really a statement about the present, because the intention is in the present - note that it's "if I am", not "if I will be"! Therefore, the second part of the sentence, "...I will never be absent from school", doesn't really match, because it's in the future tense.
I can think of some cases where the future will would be appropriate, for example
If I am expected to cook dinner tonight, I will need someone else to get the kids from school.
I think this sort of future will is used mainly to express something that makes the hypothetical possible in the future, as in "I will need someone else to get the kids from school (in order to make it possible for me to cook dinner)." But in your sentence, never being absent isn't something that makes being a teacher possible; it doesn't make sense to say "... I will never be absent in order to make it possible for me to be a teacher."
If I become a teacher... is a hypothetical statement about changing into something else in the future, so "will never be" makes more sense here - it's like "If I do X, then I will do Y."
The "am to be" part is an unusual but correct phrasing. The general pattern is "noun BE to verb-phrase". For example, you might say
I am to visit them on Monday
You are to take all the medicine
She is to be sworn in as judge next week
He was to have been crowned king
The phrasing means that there is an expectation or intention of the verb phrase.