In stroke play, if a player who is starting a hole plays a ball from outside the teeing area (including from a wrong set of tee-markers for a different teeing location on the same hole or a different hole) the player gets the general penalty (two penalty strokes) and must correct the mistake by playing a ball from inside the teeing area. The ball played from outside the teeing area is not in play. That stroke and any more strokes before the mistake is corrected (including strokes made and any penalty strokes solely from playing that ball) do not count. (Rule 6.1b(2))
In foursomes, if a stroke is cancelled, replayed or otherwise does not count under any Rule (except when a stroke is made in the wrong order), the same partner who made the stroke must make the next stroke for the side. (Rule 22.3)