The chemical separation of Li+ ions induced by a magnetic field during the hierarchical structure formation can reduce initial Li abundances in cosmic structures. It is shown that cosmological reionization of neutral Li atoms quickly completes as soon as the first star is formed. Since almost all Li is singly ionized during the main course of structure formation, it can efficiently separate from gravitationally collapsing neutral gas. The separation is more efficient in smaller structures which formed earlier. In the framework of the hierarchical structure formation, extremely metal-poor stars can have smaller Li abundances because of their earlier formations. It is found that the chemical separation by a magnetic field thus provides a reason that Li abundances in extremely metal-poor stars are lower than the Spite plateau and have a large dispersion as well as an explanation of the Spite plateau itself. In addition, the chemical separation scenario can explain Li abundances in NGC 6397 which are higher than the Spite plateau. Thus, Li abundances in metal-poor stars possibly keep information on the primordial magnetic field and the structure formation history.