How do I ask a professor to recommend me to another professor to hire me as a teaching assistant? I have been admitted into a college in the US for a master's program. I am applying for TA positions under various professors because TAs get tuition benefits.

One of the professors who taught me as an undergrad (Prof. X) knows a professor in the department where I will be studying (Prof. Y). How do I ask Prof. X to recommend me to Prof. Y?
Before asking for the letter of recommendation, you should ask your new department how TA positions are handled in your new program: you'll want to know


does Prof. Y even need TA's—not all courses get TA's assigned;
who is responsible for deciding who will TA which course;
when the decisions will be made.


If you find that Prof. Y needs a TA and that you'd be capable of doing the assignment, then you can approach Prof. X and ask if he'd be willing to recommend you to Prof. Y as a potential TA candidate.