late 12c., "formal assembly held by a sovereign," from Old French cort "king's court; princely residence" (11c., Modern French cour), from Latin cortem, accusative of cors (earlier cohors) "enclosed yard," and by extension (and perhaps by association with curia "sovereign's assembly"), "those assembled in the yard; company, cohort," from assimilated form of com "with, together" (see com-) + stem hort- related to hortus "garden, plot of ground" (from PIE root *gher- (1) "to grasp, enclose").
Both senses of the Latin word emerged in English. From the purely physical sense come "palace, residence of a sovereign" (c. 1200), "enclosed space connected with a building or buildings" (early 14c.), and the sporting sense "smooth, level plot of ground on which a ball game is played" (1510s, originally of tennis). Also "short arm of a public street, enclosed on three sides by buildings" (1680s), formerly noted for poverty or as business districts.
From the notion of "surroundings of a sovereign in his regal state" (c. 1200) comes the legal meaning "a tribunal for judicial investigation" (c. 1300, early assemblies for justice were overseen by the sovereign personally), also "hall or chamber where justice is administered" (c. 1300). As an adjective, "pertaining to a court," late 13c.