Usually you just end up there, in the way most football coaches start off as either football players or some sort of team member. Most producers used to be musicians, perhaps not successful ones, who eventually became agents or something. Or had the right connections.
I worked as a producer for many years, even when I was still singing professionally myself, mainly in an effort to help out young talented musicians, since I already knew how to make an album and could do it a lot easier than they could. We had a small indie label that eventually went bust, and then I opened up a new one with a friend. That one is still going strong and he’s the one doing the productions (I’ve since quit due to family reasons), but I still try and help out people sometimes.
Being a producer means you somehow got to know how the whole system works and what the process of making an album is. The better you know it, the better results you can expect.