MK Dons midfielder Samir Carruthers and James Collins, who was on loan to Northampton Town, appeared to relieve themselves on a balcony in March.
They apologised for their actions, which saw the pair pour the contents of the glass over the balcony.
Collins can appeal against the ban in two years and Carruthers in a year.
Rosie Margarson, from the British Horseracing Authority (BHA), said: "The disciplinary officer was satisfied on the evidence put before him that all individuals should be excluded from the sport."
Two footballers who were photographed apparently urinating into a glass at Cheltenham Festival have been banned from all racecourses in the UK.