Snakes are an environmental hazard, and are either an early-game nuisance to the cautious or a legitimate danger to the hasty. Snakes are only ever encountered when you make use of your non-upgraded Shelter. If you attempt to go to sleep in the non-upgraded Shelter, there is a random chance that a shake will be present inside the shelter. If this happens, your character will immediately emerge from the Shelter, make a word balloon comment about something being inside of the Shelter, and will lose a small amount of health. You will not be allowed to sleep until the snake has been removed from the Shelter.
To avoid random encounters with snakes, or to remove one that you know is present, make use of the option to Inspect the shelter before you try to go to sleep. You can select the option by clicking on the Inspect icon or pressing the corresponding hotkey when the Interaction Menu for the Shelter is open. When you select this option, a short countdown timer will appear, and when it has run out, your character will either inform you that the Shelter is clear of threats or will throw out a snake, which promptly disappears, and then comment on the critter having been in the Shelter. Because some players have reported finding multiple snakes in successive inspections, it is recommended that you inspect your Shelter until your character gives you the all-clear signal.
Once you upgrade the Shelter to level 2, snakes are effectively removed from the game. For more information, see the Shelter page.