Appears at first glance to be from Middle English leyer, leyare, equivalent to lay + -er. In which case, ultimately identical to the other word below that is also spelt layer.
However, this word layer (referring to a thickness of a material covering a surface) has long been argued to be from a respelling of an obsolete sense of the word lair that was once used by farmers, which had to do with soil. The connecting sense between the usual meaning of lair and the specialised farming meaning was: an area where cows typically rest, the ground being fertilised by their waste. Related to lie#Etymology_1, ledger.