It means that an event is extremely unlikely but occurred anyway.
The odds of something occurring is a statement of probability. If the odds are high, that means something is likely to occur. If the odds are low, that means the event is unlikely. "Against the odds" means something was unlikely to occur, but it did anyway.
Against all odds, the slowest horse won the race.
You can also use to say something is very likely.
The world champion will probably beat the novice boxer. The odds are in his favor.