That's a junction box especially for the pool light. A cord inside of a length of red brass pipe extends down to the wet niche fixture in the pool wall.
I don't know what the Code required at the time this was installed, but currently:
1. It must be 4" above the deck, or 8" above the maximum water level (whichever is higher). {This is not.}
2. It must be 4' or more from the edge of the pool. {This is not}.
3. The conduit must not contain any non-GFI protected wiring. {This does not even have GFI for the light, and there's another circuit running through it to a recp on a patio}.
4. As is obvious, the proper grounding path is non-existent on this mess.