Milk was a creamy white emulsion produced from the mammary glands of several mammalian species, including the Earth cow and the Klingon targ. Cetaceans on Earth produced milk to nurse their calves. (Star Trek IV: The Voyage Home; TNG: "In Theory") Containing rather significant amounts of nutrients such as proteins, saturated fats, calcium, and most notably, Vitamin D, it was often consumed on Earth as a beverage. Milk could also be processed into dairy products such as cheese, yogurt, and ice cream, as well as incorporated into various kinds of dishes.
Lieutenant Kevin Riley drank milk while on duty in the engineering section of the USS Enterprise before it was poisoned with tetralubisol by Lenore Karidian in 2266. (TOS: "The Conscience of the King")
In 2268, when Ensign Pavel Chekov was served vodka at the bar on Deep Space Station K-7, Lieutenant Commander Montgomery Scott made fun of his choice of drink by asking when he was going to get off of that milk diet. (TOS: "The Trouble with Tribbles")
That same year, Jean-Luc Picard illustrated the cultural importance of the horse to ancient Human cultures by describing how a fine warhorse would sleep in a Bedouin's tent, carry him into battle, and provide milk for his children. (TNG: "Pen Pals")
When milk was heated, the amino acids it contained acted as a mild sedative, helping one sleep. Warm milk was Lt. Reginald Barclay's drink of choice on the USS Enterprise-D. (TNG: "Hollow Pursuits") Captain Picard's aunt Adele had a recipe for steamed hot milk toddy with nutmeg, which Picard shared with Doctor Crusher. (TNG: "Cause and Effect", "Schisms")
On two separate occasions, Dr. Crusher prescribed a glass of warm milk toddy to Commander William T. Riker and Jean-Luc Picard (with a dash of nutmeg) to help them sleep. (TNG: "Schisms", "All Good Things...")
Quark prepared warm Enyak's milk when Kira Nerys appeared "rumpled." (DS9: "Ties of Blood and Water") Similarly, Q suggested warm Kylerian goat milk to Captain Kathryn Janeway when she was having trouble sleeping. (VOY: "Death Wish")
Geordi La Forge compared the spaceborne species dubbed Junior feeding on the energy of the USS Enterprise-D to an infant being fed with milk. In order to dispose of the creature which was rapidly draining the ship's power, he realized that he had to "sour the milk". (TNG: "Galaxy's Child")
On some replicators, a milk button was available for easy manual input.