The first law degree you need to become a law professor is the Juris Doctor. You are awarded this degree upon your successful completion of law school; therefore, it is considered a postgraduate degree, and no other degree is needed to teach law in the United States. If you are considering teaching outside the United States, be aware that law schools in other countries usually require faculty to have one or more advanced legal degrees beyond the Juris Doctor, according to "The Academic Path: Becoming a Law Professor."
The Master of Laws degree program is designed to train law school graduates in specialized areas of the law; for example, tax law or corporate law. The Master of Laws, or LL.M., is not required to become a law professor at an American law school, but according to Marc DeGirolami at PrawfsBlawg, it's a prerequisite for the Doctor of Law degree, which specifically prepares you to become a law professor.
The J.S.D., or S.J.D., is a doctorate of law degree. J.S.D. is Latin for Juris Scientiae Doctor. In English, it's referred to as Doctor of Juridical Science. Unlike the LL.M., which focuses on practicing specialized areas of law, the J.S.D. is a specifically academic degree. J.S.D. programs are intended to prepare individuals who want to become law professors or legal scholars. However, since you must have the LL.M. before you can get a J.S.D., universities with J.S.D. programs usually offer it in tandem with the LL.M.
Although additional degrees beyond the first law degree, the Juris Doctor, are important, and in some instances essential, to becoming a law professor, they are not the only form of credential that's needed. Traditionally, the path to securing a law school teaching position has been a combination of stellar achievement in law school, making law review, and serving as a judicial clerk, preferably at the Supreme Court or a federal appeals court. Or you can follow a slightly different path by applying for a fellowship, at your own or another law school, after earning your Juris Doctor degree. This is an excellent way to research and write while getting a foot in the door of a future employer. According to Anayat Durrani at Law Crossing, most law school fellowships are paid, although they don't necessarily pay a princely sum.