The joke is a pun. Fabric stores sell cloth materials for sewing and creative works.  When a comedian says they're looking for 'new material' they mean they are thinking up and writing new jokes.
The comedian stopped at the fabric store on his way to a comedy gig . He was looking for new material .