The president nominates justices to the Supreme Court, subject to majority approval by the Senate. There are no rules spelled out in the Constitution regarding the qualifications of judicial candidates, so technically, the president can nominate anyone he or she wants. However, there are certain traditional attributes that viable candidates for a spot on the Supreme Court should have if he or she is to have any chance of Senate approval.
Every Supreme Court justice has been a lawyer, and for the last 150 years they have all been graduates of accredited law schools. John Marshall, considered one of the greatest justices to ever serve on the Supreme Court, only attended law school for a few weeks. He studied law as a teenager by borrowing law books from a nearby lawyer (Aaseng, pg. 20).
For the last few decades, almost all Supreme Court nominees have been federal judges.
Nominees generally have participated in politics to some extent, though this can take many forms. Some are involved in unions or other politically active groups, while some served in Congress or were state governors. One chief justice was a former president -- Howard Taft became Chief Justice eight years after he left the Oval Office.