The sentence is a conditional sentence, and is a more concise version of "In order to wake up on time, set your alarm before going to bed", but for the sake of simplicity, we simply lost the "In order", as the sentence still gets across the same meaning without it.