There are a number of mitzvos that address various forms of witchcraft and sorcery. In this mitzvah, the Torah bans divination, the practice of trying to foretell the future. (This is not to say that any of these magic arts necessarily work. If a country were to pass a law banning tarot card reading, that could either be because they believe the practitioner is dabbling in “dark arts” or because they consider it a hoax. The fact that the Torah prohibits certain things is not a statement one way or the other as to whether or not these things are effective.)
So what’s divination? It’s when someone takes a particular course of action (or refrains from a course of action) because he ascribes significance to some innocent happenstance. For example, “Oh, no! I put on two different socks this morning! It must be a sign that I should cancel my flight!” would be divination. If you have mismatched socks on, you may have gotten dressed in the dark, but it has no bearing on the safety of your flight. Being afraid of a black cat crossing one’s path as a sign of bad luck is along these lines.
Occasionally, we see people in the Bible appear to act counter to this mitzvah, but one must analyze the circumstances. For example, in Genesis chapter 24, Eliezer said that he would know that the girl who not only gave him water but who also watered his camels would be the wife for Yitzchak (Isaac). Similarly, in I Samuel chapter 14, when Jonathan infiltrated a Philistine camp, he said he’d know that God had delivered the enemy into Israel’s hands if the Philistine sentries said “Hey, you! Come over here,” instead of “Halt! Wait there and we’ll come to you.” In these cases, the “signs” were related to what they were looking for. Eliezer was seeking a girl who was extra-kind, to join the family of Avraham (Abraham), who was renowned for his acts of kindness and hospitality (as is most evident in Genesis chapter 18). Jonathan was trying to gauge the enemy’s strength and confidence; his “sign” was based on whether the enemy feared an Israelite ambush or if they considered themselves unbeatable. Since relevant “signs” are permitted, something like an oncoming tornado would be a perfectly valid reason to postpone a flight. But your socks aren’t.
The reason for this mitzvah is simple enough. To put it bluntly, trying to connect everyday occurrences to upcoming events is stupid and God doesn’t want us to do stupid things. The Torah tells us outright that omens have no power over the Jewish people: “There is no sorcery over Jacob and no divination for Israel” (Numbers 23:23). Since God has told us that omens have no bearing on our lives, why should we spin our wheels?
This mitzvah applies to both men and women at all times and in all places. It is discussed in the Talmud in tractates Shabbos (67a-b) and Sanhedrin (66a). This mitzvah is codified in the Shulchan Aruch in Yoreh Deah 179. It is #33 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #165 of the 194 negative mitzvos that can be fulfilled today as listed in the Sefer HaMitzvos HaKatzar of the Chofetz Chaim.