The chemical reactions and pathways involving teichoic acid, any polymer occurring in the cell wall, membrane or capsule of Gram-positive bacteria and containing chains of glycerol phosphate or ribitol phosphate residues.