mid-15c., "the weighting of a fishing line," verbal noun from plumb (v.). In early Modern English "the art of casting and working in lead." Specific meaning "water and drainage pipes and other apparatus used for conveying water through a building" is recorded by 1875, American English.
THE apparatus by which the water from a reservoir is carried about over a building and delivered at points convenient for use, is called by the general name of plumbing. The word "plumbing" means lead-work; and it is used to signify this water apparatus of a house because the pipes of which it largely consists are usually made of lead. [Edward Abbott, "Long Look House: A Book for Boys and Girls," Boston, 1877]
Alternative plumbery for "lead-work" (also "a building in which lead-work is done") also is mid-15c. The slang meaning "a person's reproductive organs" is attested by 1975.