Spray foam isn’t a good idea. It’s not waterproof long-term and could be harmful if the chickens peck at it. If the leaks are at seams or screws, use roofing sealant or butyl tape and replace any bad fasteners with rubber washered roofing screws. If the metal panels are too damaged, replace them with lightweight metal roofing rather than wood, since the shed likely can't support the weight of a wooden roof. Keep it light and weatherproof.Yeah, those are not in good shape. Any idea on the age of the building? Looks to be galvanized. Is the rust on the top of the panels worse or better than the underside?
The purlins (the silver metal cross members the roof is screwed to) appear to be OK, so you could replace the roof panels and probably be fine. Rather than buy some from a big box store, find a lumber yard or supplier that can give you panels cut to the length you need. They will be cheaper and you won't have cut anything, just screw them in place.
Here's a place you could try:
Charlotte roofers