Everyone is guilty of doing it. You see someone post about the good times in their relationship and you say, "I wish I had that!". However, chances are, you don't want their relationship. No one ever hardly posts about the bad times in their relationships. Even if they did, you wouldn't envy it then, so I wouldn't envy it through the good times either.
Now, to say every relationship that has bad times means that it is a bad relationship, is overreaching a bit. However, just by looking at a photo, you don't know the whole story. You don't know if behind closed doors, he hits her. You don't know if she's been cheated on, or he's been cheated on. You don't know everything that has gone on. That in itself in a scary truth, knowing a relationship could look so picture perfect, but still be so toxic. Plus, you never know that if by commenting on a photo, saying "relationship goals" if you could be hurting them even more. Unless you know the person and they are comfortable enough to confide in you, I wouldn't envy their relationship.
On that note, I wouldn't envy their relationship regardless.
Just because they have what makes them happy, doesn't mean that same situation would make you happy. For example, they could have a clingy boyfriend/girlfriend that blows up their phone constantly and that makes them happy, but clingy irritates you so you would be more likely to not be happy in that relationship and break up. You have to find your own person and build your own relationship that makes both of you happy. In my case for instance, some girls need to see their boyfriend/girlfriend multiple times a week, but I don't. I can go a few weeks or a month if need be, and I wouldn't be crying about not seeing them. Not everyone is built for long distance and that's okay.
Also, if you're in a relationship with someone, commenting "relationship goals" on someone else's photo, you never know if your significant other could see that and be hurt. They might think that you see what y'all have isn't what you want, that you want a different relationship. It's okay to say, "Y'all are cute" or "I love y'all" but whenever you insinuate that what they have is better than what you have, that's when you get into rough waters. Chances are you didn't mean to make your partner feel like what you have is insufficient to what someone else has, but they didn't know that. They just saw what they saw.
So, the lesson to learn here is that I wouldn't envy anyone's relationship. Whether it's good, bad, or whatever the case may be, you don't know the full story and what goes on behind closed doors. Why would you envy something if you don't know what you're envying?