A mattress on the floor usually slides due to a lack of friction. To prevent slipping, putting something under the mattress like a rubber pad, a foam mat, or a rug will also do the job.