Let's take a look at the former sentence first: "If I have to type then, I need to switch on my system." This sentence implies that if you have to type at a certain time in the future, then you have switch on your system.
Now, let's look at the latter sentence: "If I have to type, then I need to switch on my system." This is an example of a conditional statement. The sentence implies that in order to do something (in order to type), you have to do something else (switch on your system). Also, in this example, the phrase "If I have to type" serves as an introductory element, and therefore, the comma should be placed after "type."
Whether in scientific writing or every day correspondence, sentences in which the comma appears after "then" would be of the former type.
Another comma-related problem authors face is Research paper: Comma after "etc." at the end of a sentence.