The wide man, signed by Steve Evans last summer, has fallen down the pecking order at the NYS and had previously been out on loan at Aldershot.
25 year-old Ainsworth has signed a deal with the Fir Park club until January.
Evans told themillers.co.uk : “In the last week we’ve had a number of enquiries about Lionel but the offer from Motherwell seemed to be a good one, and one that I felt would really benefit the player.
"Stuart McCall has been first class in the way the deal has been conducted and I wish Lionel all the best during his time in Scotland.”