The rubber seal is holding up the shelves? Something is wrong there. That seal should not be holding up anything. Maybe just a miscommunication.
However you Can glue the seal back on, but it may not seal properly. It is really hard to get it right. Better usually to just buy a new seal.
There are lots of different glues that you can use. Silicone adhesive, gorilla glue, epoxy, all should work. There are lot of other options as well.