Yes, spices can contain fungal spores. Spices and herbs generally are very dry and micro-organisms normally cannot grow in these products. Some bacteria and most fungi, however, produce spores, which do survive on spices and herbs. The spores are inactive and will not grow on the spices. On the other hand, when the spices get moist, the spores will germinate and growth will occur. As fungi can grow under more dry conditions than bacteria, spices and herbs normally will be spoiled by fungi and not by bacteria.
Most fungi isolated from herbs and spices are members of the genera Penicillium and Aspergillus, common fungi found all over in the environment. In spite of the fact that the majority of these fungi are innocuous, some toxin-producing species exist. As most people will not use mouldy herbs or spices, there will be no health risk from these fungi.
Even though bacteria normally will not be responsible for the spoilage of spices and herbs, there is a risk of bacterial spores germinating in a product prepared with these food items. As growth conditions in a product generally are very good, bacteria from the food items are an important factor of (re-)contamination of (cooked) products. Refrigeration of the products will reduce bacterial growth.