The primary focus of this thesis is the formation of low-mass protostars, specifically the earliest deeply embedded phase, when material from the collapsing envelope is still accreted onto the growing young star. Rotational transitions of CO and O2 data are obtained by the Herschel Space Observatory key projects, WISH and HOP, together with ground-based observations from APEX and the JCMT. We have found that CO and its isotopologs have different line profiles tracing different materials in the protostellar regions. Our new high-J rotational transitons of CO is key to characterize the warmer parts of the protostellar envelope and quantify feedback of the protostars on their surroundings in terms of shocks, ultraviolet (UV) heating, photodissociation, and outflow dispersal. Radiative transfer modeling was performed to determine the CO abundance structure in the envelope, showing evidence for significant freeze-out in the coldest regions in the parts of the envelope where the temperature exceeds 25 K. A tentative detection of O2 is reported toward the source position of a protostar, which originates from the surrounding cloud. These kind of detailed studies of the physical and chemical structure of low-mass protostars are important for a complete understanding of the evolution of young stellar objects (YSOs).Interstellar matter and star formatio