The origin of IBD segments is depicted via a pedigree of 12 individuals. Each box (male) and circle (female) represents an individual with two homologous chromosomes as bars. The top row shows three couples with their chromosomes colored differently. Due to crossing over, offspring inherit recombinant chromosomes of their parents. The first order cousins in the bottom row share one IBD segment (borders marked by grey lines). Both have inherited this IBD segment from the same individual, namely their grandfather (orange colored chromosome in the top row). Diagram courtesy of Gklambauer, Wikimedia Commons.
The IBS (identity by state) definition refers to the fact that at some point two individuals, even if they are not related to each other, present the same allele at a specific locus. Because of their un-relatedness this similarity probably arose from a similar mutational event. On the other side, with IBD two individuals happen to share the same allele because of their coancestry.