If whatever it is doesn't go back where it belongs then you have some form of prolapse a Urinary bladder,hemipenes, or the colon. The hemipenes will sometimes return with a little help, but if it remains out, keep him on clean paper towel that has been dampened so that things don't dry out and take to a Vet. to get some help. They may need to make an incision to get things back where they belong and then stitch things back up so things stay. If by chance things have returned to normal, when you start feeding offer a smaller than usual food item for a few months and make sure the animal is hydrated.
Hope things go well, Mike Derks