Only cows that have already given birth can produce milk. When the cow is pregnant, its mammary glands get ready to make milk for its calf. The nutrients obtained from the grass it eats are collected from the blood stream into the mammary gland where the milk is produced.
1 Additional Answer
Cows eat Green grass which contains large amount of basic carbohydrates and other nourishing elements. Complex chemical reaction produces milk in cows.