The process in which organisms synthesize organic matter from inorganic materials, or the organic matter itself.