I have a close friend who, for various reasons, can't have kids. We've talked a lot about this, because it's a hard thing to have to go through.
Basically, it comes down to the fact that while you mean well, everyone is going to be telling them this (or a variation) - or at least that's how it will feel for them. Telling them they'd've been great at something they can't do (yes, there are other options for parenting, but they're likely going to need time to grieve this before they think of tackling any of that, if they choose to) is likely to be difficult to hear. Think of it similar to other times of grieving, that might help your approach.
I understand you mean it as a sort of supportive thing, like you want to honour the fact that you think they're great people who would help a child grow to be an awesome person. That's super commendable of you.
Perhaps instead, try avoiding mentioning how good or not of a parent they would have been, as you likely want to avoid making them face the hard fact that regardless of how good they would have been, that particular opportunity is gone. Telling them you support them, that you are there for them, that you are willing to be a listening ear if they need to talk (if you're close enough that that makes sense), checking in to see if they need anything (for some people, it can feel almost like a death in the family in terms of the pain and sadness).
Be prepared for the fact that they might not want to talk about it, and they might not want you to do anything in particular for them - give them the time and space to sort out their feelings on it. But if you just are patient, and kind, and so on, it will work out.