At the Captain's discretion, the ship's counselor may be allowed to wear something other than their normal Starfleet uniform while on duty. This was the case with Deanna Troi, the ship's counselor on the USS Enterprise-D. (Deanna elected to wear a uniform permanently after being told to do so by Captain Edward Jellico (TNG:"Chain of Command, Part I".)
The USS Voyager was not originally assigned a counselor as its mission was intended only to last a few months. Later, Neelix appointed himself morale officer, a term of his own invention, to take on the responsibilities of a counselor.
According to a early draft of "Relics" (TNG), Counselor Troi explained that the responsibility of a ship's counselor was to take care of the emotional well-being of a ship's crew and guests. Starfleet began assigning counselors to starships in the 2330s, after they realized that the pressures of extended space travel could result in psychological problems that would require professional care.