The infinitive mood is commonly used for expressing rules especially in signs (of any kind, not just road signs).
Non calpestare il prato
Tenere la destra
The language "trick" behind this use of the infinitive form is the omission of the clause Si prega di or equivalent, so the above sentences are read as
Si prega di non fumare
Si prega di non calpestare il prato
Si prega di tenere la destra
Such form is not used in everyday's spoken language, as it's a convention used for giving orders and stating rules in an impersonal and formal way.
That being said, there's an official use of the infinitive mood as imperative, which is the negative imperative.
In Italian the positive imperative form goes as follows
Tieni la destra!
Parla con lei!
whereas the negative imperative is formed with non + infinitive mood, as in
Non tenere la destra!
Non parlare con lei!
As discussed in the comments, it's also nice to notice the differences and the similarities with other Romance languages, such as Spanish and French.
Apparently French has the same identical construct as Italian for expressing formal impersonal orders, for instance
Ne pas fumer
which is again a shortening for
Merci de ne pas fumer
Grazie di non fumare or more idiomatically Si prega di non fumare
On the other hand Spanish behaves differently and it doesn't have a special construct for impersonal orders, rather just using the formal imperative form, which is formed with the subjunctive
Non fumare, but also Non fumi
Reduzca la velocidad
Ridurre la velocità, but also Riduca la velocità