Could I ask a recommendation letter from a professor who left the university?
If the faculty is retiring to emeritus status then they can still write on letterhead. Many emeritus still maintain an active research profile or use the time to write, but in any case they might be willing to write for you. Many enjoy keeping one foot in the teaching/advising world.
There's nothing to be lost by asking.
And from the perspective of people on admissions committees, a strong letter from an emeritus faculty who compares this student against their thirty or forty years of other students can be very persuasive.
I'm a retired math/cs professor and love getting reference requests from former students. I'll always tell the asker what kind of letter I would be able to write (depending on how good the student was and how much I remember). Then s/he can decide whether to include me.
I've no problem writing on university letterhead.
Yes, I think asking them is ok, with a few caveats.
I think it's ok provided the professor has only recently retired (within the last year, say). Any longer ago than that leaves a chance that the professor has forgotten who your friend is and means that the quality of the letter may be diminished.
Another thing to consider is if the professor is still affiliated with a university or institution. When I was applying for PhDs, some universities required the reference letter to be submitted on official letter-headed university paper (or the electronic equivalent). This may not be possible if the professor is no longer affiliated with any institution.
As to whether or not it's actually appropriate to ask, your friend should consider how much the professor is enjoying their retirement and whether they would welcome a request for a reference and all the associated admin or not. This is something only your friend can judge, based on his previous relationship with the professor.