When you open the fridge, warm air from outside rushes in. When you close the door, the warm air cools and contracts, creating a temporary vacuum that keeps the door stuck to the fridge. The vacuum effect lasts only seconds so you can soon open the door comfortably again.
Picture Credit : Google