mid-14c., "in agreement with" (now obsolete), from according + -ly (2). From mid-15c. as "properly, adequately;" meaning "agreeably with logic or expectation" is from 1680s.
continued to have severe headaches and accordingly returned to the doctor
she acted accordingly