"...popped out of the first plastic ring attached to the barrel."
I have three 590s and all of them metal barrel retaining rings.
From what you have described, it sounds like the detent pin for the mag cap had popped out. Does the cylindrical metal piece have a round end to it?
If this is the case, this piece (along with the spring underneath it) is held in place in the barrel ring by having the edges of the hole they reside in peened over by a punch. This is how it appears to me on my samples. My suggestion would be to find a punch of the right size to knock the edges of the hole over the pin to prevent it from coming out. The punch could hold the pin and spring in while you pound the edges inward. Be careful not to punch the edges over to much 9too deep0 so that the rounded portion of the pin is below the front surface of the ring. It needs to be above this surface to do its job, that of preventing the cap from unscrewing by sitting into the grooves of the cap. If the pin is knocked below the surface of the ring, nothing will prevent the cap from unscrewing under recoil.