I recommend drilling stay channels in the shelf to prevent them from moving forwards or backward.
You'll need a drill, drill bit and a craft knife to modify the shelf.
Place the shelf back into the cabinet and mark the position of the shelf pins with a pencil. Use your drill to drill a hole above the mark you made with a pencil. Cut the melamine with your craft knife to open up the channel.
I've placed a sketch below to give you an idea of how to position the cutouts on your shelf. - EricL
You could also try Velcro tape or Velcro dots on your shelves to stick them to the back of your cabinet. You might first want to try sticking a small piece of the tape to an inconspicuous part of the cabinet to make sure that it doesn't damage the finish of the cabinet when you pull it off. - BradN