Holy shit! was an expression used in 1985, as a strong explicit form of saying "uh-oh" or "oh no". Marty was prone to use this exclamation when he was surprised. Such occasions included watching the Libyans' sudden appearance; looking in his rearview mirror and noticing that a rocket launcher being aimed at him; surfacing from a pond and realizing that the Courthouse Mall has been smashed; realizing that old Biff Tannen had been in the DeLorean time machine; and realizing that Clara Clayton had been meant to fall into Clayton Ravine
Behind the scenes
The oxymoronic expression "Holy shit!" was the latest of many variations of "Holy cow!", an expression often used by teenagers in radio, comic books, television and movies, that was first popularized by a clumsy character named Dexter in the Corliss Archer radio program (1943-1956). Since the mid-20th century, comic book characters Batman and Captain Marvel would replace the word "cow" with other words appropriate for the situation they were in.
Fox used the line five times throughout the trilogy. (all of which can be viewed here).