Was it hot outside?
Sometimes when cattle get too hot they pant and it foams around their mouth. A few of ours were recently doing it because they have not shed their winter coat yet.
It was 26 feels like 30 today and my Galloways still have winter coats - one who has just calved was panting and foaming but eased off as the slightly cooler night temp arrived