It's pretty weird that someone you didn't know that well used you out of the blue years later. I'm guessing they must have been struggling to get references, or specifically needed a professor and grad school didn't go well.
Unless someone specifically told me I could use them whenever (and I've got a few of those) I give them a heads up beforehand. If it's for a job I give them a heads up anyway.
My latest reference deals were for professional engineer licenses, and I used 5 people from a couple jobs back, who I worked with for many years, and have used before for PE references (your references all have to also be licensed). I didn't let them know beforehand, but they were just getting an e-mail with a form to fill out in this case, and I knew they'd all be cool with it. And if they weren't, I could just delete the reference and add a new one.
When I applied for this job recently, I asked everyone beforehand, because I knew they might get a random call, and I wanted them to be prepared.