If a worker is hired to deal with something edible that grows from the ground, he's allowed to snack from the produce, though there are some parameters. For example, a person who works with already-cut produce may only eat until he's completed his work; after that he's off-duty and no longer entitled to pick. On the other hand, one who works with still-attached produce may only eat after he's finished his work. For example, if his job is to pick grapes to fill a container, he must fill the container before he can pick any for himself. In order not to steal time from their employers, they should eat as they travel from row to row in the field, at which time they would not be picking anyway.
The reason for this mitzvah is to improve our characters through generosity. God has given the owners of the fields an abundance of good things; it doesn't behoove them to act stingy and begrudge their employees a snack.
This mitzvah only enables those who work with produce to snack. Those who work with food that doesn't grow from the ground (such as cheese), or those who guard produce (as opposed to, say, picking it) are not entitled to eat. Additionally, one may only eat the type of produce with which one is working, from the field in which one is working, so someone stomping grapes isn't entitled to eat corn.
This mitzvah applies in all times and places. It is discussed in the Talmud in tractate Baba Metzia (87a-89b, 91b-93b). It is codified in the Shulchan Aruch in Choshen Mishpat 337. This mitzvah is #201 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos and #65 of the 77 positive mitzvos that can be fulfilled today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar.