Plants primarily obtain nitrogen through the soil in the form of nitrates and ammonium ions, which they absorb through their roots. These forms of nitrogen are made available through the process of nitrification and nitrogen fixation by bacteria.