The sequence of tenses in English is quite well defined. If you feel like more details just have a look at this link. And when we think about how the imperative is used in English when it comes to reported speech, you can have a look at this link.
When it comes to the question how in German the imperfect is used in the reported speech we come to another auxiliary construction; a construction with the modal verb sollen. However, things are never easy in German language. That's why it is not the indicative of sollen, but the conjunctive I.
Er sagt: "Mach es jetzt!". = He says: Do it now!
ich solle es jetzt machen. (reported speech) =
He told him to do it now.
Sie sagte: "Verdien erstmal
Geld!" = She said: First earn some money!
ich solle erstmal Geld verdienen. (reported speech) =
She told me to first earn some money.
It is not too difficult, isn't it? Then again, it's not that simple. If the introductory word is another than sagen the construction is another one.
Er befahl mir, es jetzt zu tun.
He ordered me to do it.
Sie wies ihn an, die Socken zu wechseln.
She ordered him to change his socks.
Introductory verbs as befehlen, anweisen, auffordern, bitten require an infinitive with zu in the construction for reported speech. This again is exactly the way the English system works as you can see here.