This question pops up frequently on various forums:
How do I generate metadata?
So I thought I'd collect a few links:
(Note: I haven't tried all of these - they may or may not work - use at your own risk - backup current metadata first if required).
Federation Metadata Generation Tool
STS Federation Metadata Editor
Also, have a look at the code inside:
You will see that it's generated dynamically.
Geneva-based WS-Federation metadata document generation wizard