If you wanted to find out something about somebody, would you look on social media? The government is no different. Immigration officials check social media. They can do so for all sorts of legitimate reasons. While naturally immigration officials have security concerns, they also have the responsibility to evaluate the veracity of the evidence presented on your behalf. Social media easily provides unfiltered information to them.
In short, I tell people if you publish (post) something, you are, in effect, making a public statement. You are volunteering evidence.
The checking of social media can come up in all kinds of immigration matters not just say getting a green card for a spouse. It can come up in the employment visa context. It can come up in connection with an investment visa. Anything.
Indiscriminate posting can lead to a denial of an immigration benefit. With any posting, it would be smart to ask yourself, “is this something I want to answer questions about later (to immigration officers, a Judge, etc….)?” If you are not sure, don't post.