Both are grammatical. Depending on the specific sentence, bringing the infinitive clause to the front for the sake of emphasis could be awkward. It is a stylistic decision that departs from standard conversational word order and therefore "heightens" the register.
In your specific case, bringing it forward would also need you to take care that other phrases were not colloquial but in the same register, if you wished to avoid a "register clash":
Many people in Athens were able to save themselves from the fire but to save their children they
didn't have any timehad no time.
Standard word order is in neutral register and thus doesn't present as many pitfalls to the learner:
Many people in Athens had time to get away from the fire but they didn't have time to save their children.
Many people in Athens had time to get away from the fire but they had no time to save their children.