Welcome!
I'll answer a few of your questions ;).
First of all, exactly how dangerous can horses be?
Horses each have their own personality; but it's always important to wear a helmet when around them. Horses can be dangerous, but if you pay attention to what they're doing & their behaviors, you'll do fine! I fell off a ton of horses- it's a part of riding!
But it's always good to not act afraid/nervous/angry around a horse, because they sense that easily & might do the same to you! :(
What things do I have to watch out for?
Hmm, all horses are different, but never walk directly behind a horse, or stand directly behind a horse. They cannot see behind them; only to the side & a little bit in front of them. They may kick if you go directly behind them.
If you are walking past them, then just slightly tap their butt a bit to let them know you are there. ;)
Yeah also don't crawl under/lay in front of a horse; hey, it could run you over/trample you! They are like 1,000 pound animals, so trust me, that wouldn't be too good.
There are lots of things you gotta watch out for; but they are just a few.
What kinds of things do they usually do that could be harmful?
Well like I said every horse is different; but some may buck, kick, throw their head up, bite (yes some do bite), or rear up.
You just have to be careful & respectful of them, they should do the same to you. If they are not trained then you will have to be more cautious ;)
Secondly, what kind of work will I have to do around the stables?
Every stable is different; but for the most part, mucking out stalls is a job most of us horsepeople have to do. It does get tiring but it's all worth it in the end! ;) Feeding & watering you will probably have to do too (& some water buckets are heavy!), tacking up horses maybe, etc. Grooming a horse fun though ;)
Should I keep a separate pair of clothes just for that day (won't my clothes get really smelly?) How hard is it? Really tiring or no?
Proper clothing is jeans (old jeans if you have any; 'cause they will get dirty/muddy/ripped), & a t-shirt. Riding clothes are also good.
I mean some work is hard, some is easy; but you get used to it!
It can be tiring but like I said it's all worth it.
Thirdly, do I have any chance of gaining any muscle from all the stable work? Any chance of gaining muscle riding a horse?
Oh yes! You will definitely develop mucles you never knew 'ya had!
Well, riding a horse you do gain some muscles; see it's all about balance too, so yes you will gain some muscles ;).
I hope I helped, I'm sure other people will answer your questions too!

Good luck!