Because humanity can be desperate. Some mothers can’t make milk for their children, which is no problem now, but was a huge one back then when formula milk wasn’t a thing. One person desperate with their dying child in their arms might have seen a cow or goat feeding its child milk and thought that they might be able to do so for their dying child too. They shared what they did and the milking idea became a thing.