Pretty much as Bro said. Most go back to be refilled / reused or recycled.
Each ship was allowed to lose so many shell casings during a live fire exercise as they would be ejected through a tube at the front of the turret and some would bounce over the side but most had to be accounted for and returned.
Edit:
Forgot to add, on completion of every small arms shoot (rifles, pistols etc) the range officer would line us all up and make the following statement:
"You are reminded that it is a court martial offence to knowingly remove any live rounds or spent ammunition from this range. When I stand before you, you will make the following declaration 'I have no live rounds or spent ammunition in my possession' and address me by my rank"
He would then proceed to walk down the line and each one of us would have to make that declaration.
After each shoot we'd walk up and down the firing point collecting the spent cartridges and throwing them into an empty sandbag. Any live ammunition would have to be signed back into the ships magazine.
One of my roles on my last ship was an "Officer of the Quarter" which meant I was responsible for stored ammunition. In this case, 3 magazines containing the ships supply of decoy / chaff rockets. Each magazine would be inspected by myself daily, the weapons engineering officer weekly and all the log books checked monthly.
Every single item of ammunition on a ship is checked, mustered, cross checked and accounted for.