Wild onions contain a compound called N-propyl disulfide, which is a mild irritant in humans but is very toxic to pets and farm animals. Humans are much more resistant to N-propyl disulfide, but caution should still be used when foraging for plants, as some poisonous lilies resemble wild onion bulbs.
N-propyl disulfide is also found in cultivated onions and related plants. It is responsible for the distinct odor and flavor of the plant. It is also why cutting onions often causes eye irritation and weeping. Wild onions are no more dangerous for humans than cultivated ones, but ingestion of any sort of onion can kill cattle and other mammals.