Those are indeed related. They ultimately come from the Latin infans, meaning 'unable to speak', from the verb fari, 'to speak'. Babies are unable to speak, so obviously they're infants. But then the sense broadened to 'child' and then shifted from 'child' to 'servant', which sounds strange but is actually common in a lot of European languages. For example, words like lad, knave, knight, and boy have all historically had the dual senses of 'boy' and 'servant', especially a lowly servant. But they all shifted over the years, with senses pejorating or ameliorating or disappearing. But infant moved from servant to a lowly soldier (because soldiers were considered servants to the monarch), so that's where the modern sense of infantry comes from—it's the body of soldiers who move on foot.