in an emergency you may say your prayers while walking or riding but when you are safe remember god as he has taught you what you did not know before.
فإن خفتم فرجالا أو ركبانا فإذا أمنتم فاذكروا الله كما علمكم ما لم تكونوا تعلمون