If a photograph was exposed to high levels of humidity or became wet because of flooding, the chances are that it would become stuck to the glass. The problem could be compounded if the glass is broken or if someone makes a haphazard attempt to detach a photograph.
The Smithsonian Institute Archive has a strong warning against trying to remove a photograph that is stuck to glass yourself. That includes trying to separate a photograph from glass by putting it into a microwave oven or a freezer or heating it up with a hairdryer. Instead, they recommend that the restoration of such photographs be left to experienced photo restoration professionals.
In cases where a photograph cannot be removed from glass or if it is too damaged by shattered pieces, moisture, or debris, it can be restored by making a high-quality scan and digital retouching.