A duty officer was the person in charge of a particular position or department during a particular duty shift.
In the 20th century United States Navy, a position existed known as the command duty officer which was similar in its duties and function to the 23rd and 24th century counterpart, as the officer in command. (Star Trek IV: The Voyage Home)
While the USS Enterprise was in orbit of Alfa 177 in 2266, Lieutenant Uhura made a general announcement request to all decks, over the ship's public address system, for all section duty officers to check communication lines. Later that day, following the discovery of Captain James T. Kirk existence as into two distinct beings, one good and one evil, the search for the evil "impostor" was underway with all hands, with Kirk instructing all section chiefs to assign personnel to search parties. (TOS: "The Enemy Within")
Ensign Garrovick was the security duty officer Captain Kirk called to the bridge in 2268. He replaced Rizzo as the ranking officer from security, after the latter was attacked by the dikironium cloud creature on Argus X. (TOS: "Obsession")
When the Enterprise lost contact with the space laboratory Regula I in 2285, during Admiral Kirk's inspection tour, he announced that, due to an unforeseen emergency situation, and by order of Starfleet Command, he assuming command of the vessel. After doing so, he asked that the duty officer to note the transfer of command into the ship's log. (Star Trek II: The Wrath of Khan)
Lieutenant Monroe was the duty officer when the USS Enterprise-D struck several quantum filaments in 2368. She was killed when an impact shorted out the helm console while she was sitting at it, leaving inexperienced Counselor Deanna Troi, who carried the rank of lieutenant commander, and was therefore the most senior officer left on the bridge. (TNG: "Disaster")
In 2370, Commander William T. Riker considered who he was going to promote to the position of night duty officer at Ops duty station. He considered Ensign Sam Lavelle as the obvious candidate, but was also considering Ensign Sito Jaxa as well. Lavelle ultimately got the position, following the death of Sito. (TNG: "Lower Decks")