The particle と (TO) can form a conditional structure meaning that something is inevitable if/when something else is done. This conditional can be translated using "if" or "when" most of the time.
If you eat too much, you'll get fat (it's inevitable). When you steal, you go to prison.
There are other forms of conditional in Japanese (verb + BA, verb + TARA in particular).
歯をみがかないと虫歯になるよ。
Ha o migakanai to mushiba ni naru yo.
If you don’t brush your teeth, you’ll get decayed teeth.
明日雨が降ると、運動会は中止になります。
Ashita ame ga furu to, undoukai wa chuushi ni narimasu.
If it rains tomorrow, the sport's festival will be canceled.