Early uses of "refactor" found by searching in google books show that it has a different meaning in the early 1990s and before.
Before the 1970s (apart from misspellings of "refractor" or "refactory") its very rare appearances are associated with "finding the factors of factors
45 = (9)(5) = (3)(3)(5)
since the factor 9 was not prime it was necessary to refactor it.—(source)
However this does not seem to be related to the current meaning in computer science. For that you should look to its meaning in iterative processes. Particularly in the matrix form of Newton's method.
In this method, a matrix is calculated and at each step of the method a new matrix needs to be calculated. If the partial derivatives are known exactly then this is quick, but if the partial derivatives have be evaluated numerically, then finding the iteration matrix takes a long time. The process of finding a new iteration matrix was called "refactoring the matrix", and various computer science texts discuss how this slow refactoring can be avoided, or discuss the consequences of not refactoring the iteration matrix
from what I understand in your method, you don't refactor the stiffness matrix and in the modified Newton Raphson method you have to refactor the stiffness matrix every once in awhile. —(source)
The meaning of "improve code" was linked to the object-oriented programming movement, and early books on Smalltalk discuss programming as being an "iteration" of design-write-test-refactor
As with every facet of object-oriented application development, several iterations are required until we find the optimum distribution design. [...] Because designs tend to change during the implementation, it is necessary to refactor and optimize after the infrastructure is complete. —(source)
It is reasonable to suppose the word was coined from Latin roots (factor = make) to describe the process of building a new iteration matrix, and then was adopted for an iterative approach to writing code.