In very meaningful cases machines already have control, and armies are not unnecessary. So we can extrapolate that armies will probably also not be unnecessary in the future.
The purpose / goal / sense of life could be to fulfill / accomplish / achieve what was set in the beginning of it.
Provided that the purpose / goal / sense of technical beings is similar to the purpose / goal / sense of living beings, then we probably have to determine: In the beginning of the technical beings the replacement of those beings who created them was set, and when the replacement will be fulfilled / accomplished / achieved, then, simultaneously, the machines will either have destroyed themselves or created another being with another purpose / goal / sense.