First off, what is your motivation for doing this? When selecting a legal guardian for your child, your only concern should be how well the child will be cared for. It is not something you do mainly out of pity for your friends.
Keep in mind also that unless there is something in your situation that greatly lowers your life expectancy, the odds of both you and your partner dying in the next 17 years are quite small, so the legal guardianship will most likely never happen. That's not a "gift" to your friends who are already wanting to have a child for a long time.
Have your friends indicated such a desire?
That is the most important factor in this regard. They may not have given up on having their own baby and then your proposal may just amplify their frustration.
How will you know without asking? The most obvious clue is how they currently are acting towards your child. Are they giving a lot of attention to the child, offering to babysit, acting like family? Those are signs they are in a mental space that has room for your child. If they are hesitant around the child, it might just be nervousness out of inexperience, but may also mean it's too painful for them.
My suggestion would be to casually invite them to share in the caring for your child now and then, asking to babysit for example. If they seem happy to get involved and have something of a bond with the child, then you can bring it up. If they don't engage, they're likely not ready for it (yet).
Be prepared for the question why them and not someone in your family. Make it about your concerns and their helpfulness and not about their lack of children.