The term “in before” or as it can be seen on the internet “inb4” is used in on image or message boards, where the poster predicts the outcome as it would be an expected obvious reaction from another user.
The term was already well known and used on the messaging board called 4chan and other similar sites to basically leave a comment before the thread/discussion would expire, by saying “in before the lock”.
The first recorded use of the term in its context dates to 2007, which was a thread on the discussion board called 4chan.
Given its simplicity and “lol factor”, it didn’t need any help in becoming a term used/known by everyone in similar situations.
Its early days of only being used/known on the discussion board site 4chan quickly passed by and it has become a term used on most of the social media, image sharing and video sharing websites.
Basically, in any situation with a predictable or anticipated outcome or baiting other people on the internet, the meme/term was a very welcomed addition and is still used widely everywhere.