Before V. 10 of KM, there were no subroutines, but you could call one macro from another macro, using the Execute a Macro action. And of course you can still do this, and it may often be all you need.
So what does a subroutine offer that you can't do just by having one macro call another?
The KM Wiki explains that when one macro calls (executes) another macro, there is a limitation:
The Execute Macro action allows you to execute another macro... though without any ability to pass parameters or receive a result other than through variables...
So if you had a macro called "Main macro" and it called "Helper macro", and you wanted to pass values between them, it could be fiddly, or at least inelegant.
And that is the problem that subroutines solve.
Imagine that "Helper macro" could be replaced with something that was exactly like a macro (a sequence of actions) but actually could receive and return values easily and directly. Well...
That's a Keyboard Maestro "subroutine"!
Notes:
-
A subroutine in the general computing sense is defined by Wikipedia (and I think it will do!) as "a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed".
-
When Keyboard Maestro documentation talks of "subroutines" it is nearly always referring to KM's special callable units that can receive and return values – those neat things I have described above. However, if you read the page for the Execute a Macro action, note that the opening sentence uses the word subroutine in the general computing sense when it says that a macro can be executed by another macro "like a subroutine"!

-
Since the idea of subroutines in the broadest sense is not unique to KM, you can find plenty of examples of where you might want to think in terms of using subroutines. Here is one.