Antimatter pods (specialized forms of magnetic confinement pods) were magnetized self-contained storage units which contained un-reacted antimatter fuel for a starship. Antimatter pods used an antimatter containment field to isolate the fuel within from contact with normal matter, thereby prohibiting catastrophic reaction. (Star Trek: The Next Generation Technical Manual)
It was vital that antimatter pods be self-contained, so that their containment fields would continue to function even after being ejected from the starship. (VOY: "Resolutions") Starfleet Regulation 3287.0 compelled their use aboard Starfleet vessels. (TNG: "Night Terrors") Engineers aboard Federation starships had access to technical manuals about maintenance procedures for these pods. These manuals were stored in the Engineering Systems Database. (TNG: "Booby Trap")
In 2267, the antimatter pods of the USS Enterprise were slightly damaged by a surprise Klingon attack. At the time of the attack, the Federation starship was en route to Organia. (TOS: "Errand of Mercy")
In 2366 the non-corporeal Koinonians drained antimatter from the containment pods to use it as energy to create their replica of Marla Aster. This was stopped by increasing the shield harmonics to match the antimatter containment effectively severing the Koinonian beam. (TNG: "The Bonding")
Later that year, radiation that had leaked from Doctor Nel Apgar's station in orbit of Tanuga IV threatened the USS Enterprise-D's antimatter pod. If the radiation had surged in or near them, it would have destroyed the ship. (TNG: "A Matter of Perspective")
Later that year, while traveling back to the Enterprise by runabout, the starboard antimatter pod has been completely drained, despite the fact that there was no leak and all of the other engine systems were fully operational. It turned out that the runabout had entered a region of temporal fragments that made the antimatter pod work longer than the rest of the shuttle had. (TNG: "Timescape")
In 2372, while Captain Janeway and Commander Chakotay were trapped on a planet, Lieutenant Tuvok had to fight off several Vidiian warships. To do so, he released an antimatter pod and let it get close to the ships, and then fired a photon torpedo at it, casusing an explosion which severely damaged the enemy ships. (VOY: "Resolutions")
We can assume that antimatter pods are self-contained and survive some sorts of disasters aboard starships, such as the destruction of the starship, uncontrolled entry into an atmosphere, etc. This is because vehicles in the Star Trek universe do not consistently explode on every single occasion a vessel is catastrophically damaged. It is probably safe to assume that each pod has its own battery, or other power source to maintain the containment field, or some kind of post-exhaustion flush method. This way, it is believable that a free floating antimatter pod from a destroyed starship, or a pod remaining in a derelict hulk, could remain intact until such a time as all of the antimatter within was expended.