What is the ruling of praying on a prayer mat padded with foam? Must the place where we pray be on solid ground?

If one can stay stable on a mat or foam it is allowed