Despite possessing high theoretical gravimetric capacity, the practical utilization of silicon anodes for lithium-ion batteries is still challenging because of poor capacity retention caused by massive volume expansion upon lithium insertion. The use of porosity to tackle this issue has widely been scrutinized, and porous silicon materials have been experimentally shown to have improved cycling stability. To provide a fundamental understanding of the structural and chemical evolution, we investigated the atomistic behaviors of porous silicon nanowires during lithiation and delithiation by means of a reactive molecular dynamics method. The simulations show that although the porous nanomaterials undergo a large intrinsic volume expansion similar to the non-porous ones, the hollow space available inside the materials can be exploited to lower the external expansion via the local structure relaxation in the vicinity of the pore. Due to such relaxation, a small pore undergoes structural collapse during the first charge, suggesting that a relatively large pore diameter and a thin wall thickness are required to maintain the porous structural integrity. The simulations also unveil the evolution of the local stresses generated during lithium migration into and out of the materials, which emphasizes the role of porosity in alleviating the induced stresses.