Mattress sliding is often caused by lack of friction between the mattress and the bed frame. This can happen when there are missing rails above the slats; when you have the wrong size frame, or if you have an old mattress.