Do not cause trouble in a place where you must be on a regular basis. Often used with workplace romances but can also apply to relationships with students at your school or starting shit in general.
This phrase means "do not have romantic relationships with any co-workers." Basically, you don't want to make yourself uncomfortable (by potentially having a romantic relationship get ugly, or "shitting") at the place where you work ("where you eat").
Dude #1: "damn a really hot blonde just started working at my company. i'm gonna ask her out"
Dude #2: "dude, haven't you heard the saying: Don't shit where you eat?"
This expression refers to doing anything that would jeopardize something important or essential to you. A common example of shitting where one eats is engaging in a romantic affair with a co-worker, but lying to your roommate or stealing from friends also fits this expression.
Local Bike Shop Mechanic #1: "Can you believe that guy? I've hooked him up dozens of times, but after the tantrum he just threw, I'll never take a dime off a part for him again."
LBS Mechanic #2: "Seriously. Hasn't he ever heard? Don't shit where you eat."