The phrase was in use long before social media, and it became a common hashtag and caption in the late 2010s as shorthand for in-group references: a place, a moment, a product or an experience that needs no explanation for those who were there.
For brands, IYKYK can build a sense of belonging, because it rewards the people who already know you. It also leaves everyone else out by design, so it suits community content and loyal followers, and works less well in content meant to win new people over.