If the police suspect you have committed an offence, they may try to obtain data from your social media accounts. It goes without saying that they can view anything you post publicly. However, the police may also be able to access your private data.
One way to do this is to seize your phone after you have been arrested to directly access your accounts. The other way is to approach the social media companies directly to request your data.