The only thing that can make that statement worse is to say it after someone has had a failed pregnancy/are pregnant. To be completely honest most people don't plan on becoming pregnant. Planned or not, lost pregnancies are traumatic. There is a time and place for many things. But there is never a time, and never a place for you to say these words.
Although you probably are boundary stomping. I totally understand explaining to someone why they shouldn't have a child yet, or another one. A better thing to say would be "I really would like you to wait to have children until you are married, have your own home, car, and a stable job." But to say I don't want you to have kids because I don't want a grandchild/niece/etc is completely out of line.
Another thing that is socially common but very out of line is when people decide to run their mouth about how many children a person may have/want to have. It comes down to a simple concept. If YOU are not responsible for those children, financially supporting those children, and caring for those children you really are not entitled to an opinion on how many children someone has.
This was today's PSA. In a nutshell. Watch your mouth.