A process that is carried out at the cellular level which results in the assembly, arrangement of constituent parts, or disassembly of the cell wall, the rigid or semi-rigid envelope lying outside the cell membrane of plant, fungal and most prokaryotic cells, maintaining their shape and protecting them from osmotic lysis.