Why is the term for justices seven years?

United States Supreme Court justices are actually appointed for life. You must be referring to judges on some other court, which you would need to specify in your question.