If two people in your premade get an S, then everyone in the premade gets a chest for the champion they're currently using (unless they already got an S rank chest for that champion or don't have any chest slots available), even if they personally didn't get an S rank.
So if a graves in your premade earns an S rank while you're playing leona, you'll get your leona chest even if your highest grade was less than an S. If you later get an S on leona, you won't get a chest, since you got your leona chest from the game where graves got his S rank. If you later get an S rank on graves yourself (and haven't unlocked a chest while playing graves before), then you will get a chest, since only the champion you play in a premade matters for what champs chest is unlocked, and so that a graves got an S in a premade with you at some point doesn't matter.