But you see Cyclone, baseball is full of instances of ex post facto rule making. The Black Sox were made permanently ineligible ex post facto by Kennesaw Mountain Landis. Even though Pete Rose was banned from baseball itself based on a rule that was on the books, he was removed from Hall of Fame eligibility ex post facto. Baseball can ban Bonds, McGwire, Palmiero or anyone else ex post facto because MLB's conduct is not governed by the US Constitution.
But maybe steroids were banned by baseball back then. When Barry Bonds was allegedly taking steroids (or McGwire, Canseco, and Palmiero for that matter), there was no explicit rule banning steroids in the MLB rule book. However, steroids were considered a controlled substance by US law, illegal without a doctor's prescription. What was the rule on taking illegal drugs at that time? They had to have some rule on the books, because they were able to suspend Steve Howe, Darryll Strawberry and a number of other guys for using cocaine. Did that rule prohibit cocaine specifically, or was it a blanket prohibition on all illegal drugs? If it was a blanket prohibition, then taking steroids without a prescription would have been prohibited by MLB, even if it didn't explicitly list it as a banned substance. Of course "Greenies" would probably fall under that prohibition too, which would open up another can of worms.
In any case, MLB and the Commissioner have broad powers to discipline players, even if it might be practically limited by the bargaining power of the Players' Association. If they wish to, they may decide that Bonds' steroid use has called the integrity fo the game into question and they may choose to ban Bonds or anyone else who has used steroids.