A sliding mattress is a common problem that many people have had to deal with in the past. Restless sleepers will frequently awaken to find their mattress off-kilter. The main reason for this problem is a lack of friction between the bottom of the mattress and the box spring. The lack of friction means a small amount of directional force can result in the mattress slipping.
Position the bed into the corner of the room. Having a wall on two sides of the bed will greatly reduce the ability for the mattress to move.
Slide a rubber mat underneath the mattress to increase the friction between the mattress and box spring. The mat will grip the mattress and make it much more difficult for it to slip.
Pull an elastic band around the mattress and box spring on both the top and bottom of the bed. Connecting the two together like this prevents the mattress from slipping. The straps are thick enough and strong enough to hold up for a long time.