Especially aluminium tent pegs are a bit tricky. Most metals will become harder as they are 'worked' (as in getting bent) and the initial bend when you hit the stone will have the effect that the bend itself is harder than the straight metal around it. So if you now try to bend them back in shape you will notice the peg bending left and right of the original bend but that one just stays where it is. If you finally manage to straighten it out, the harder and therefore more brittle metal may snap. This effect is called work hardening and is especially pronounced in aluminium. For this metal it is also especially tricky to reverse, i.e. to get it soft again. The process for this softening is called annealing and for aluminium you will have to heat the metal to a temperature that is uncomfortably close to its melting point. A bit of a challenge when camping or without a metal workshop at home. But I think not impossible.
Below I'll explain how to anneal aluminium. If you have a steel peg (much easier to work than aluminium and less likely to break) or if you can't be bothered annealing the aluminium peg you can skip to the two ways to straighten the metal. For unannealed aluminium I would not recommend method 2 though, as it will most likely break.
Annealing of aluminium: In short, the purpose of the annealing process is to remove stress inside the metal, which causes it to become less workable. Aluminium needs to be heated to a temperature close to it's melting point (but obviously not above) and then doused in water, i.e. cooled down quickly.
You need plain household soap without additives like fragrances, skin conditioners etc. - this will be used as a makeshift temperature indicator so you know you've reached the right temperature without accidentally melting it. Furthermore you want a heat source like a blow lamp (I don't know if a gas camping cooker will work but it may be worth a try), a vessel with water to douse the heated peg and cool it rapidly down and a pair of pliers or disposable cotton cloth or whatever seems suitable to hold the hot peg without burning your fingers (maybe you could try and place the peg on a camping cooker where it is immersed in the flames instead).
Firstly cover the peg with soap directly from the bar (without water). Now heat the peg up until the soap on it turns black. Try to spread the heat evenly over the affected area. Watch very carefully for the soap to change colour as it is now almost hot enough to melt. Once there, quickly douse the peg in water.
If you were to try this on a camping stove you may want to apply some insulation to the straight parts of the peg so the heat you apply to the bent bit doesn't dissipate away too quickly (or you may never reach the required temperature). An old rag of tightly woven wool, or better even leather, should work well as these materials don't combust that easily - it will stink right enough and the rag will be ruined. Improvise with appropriate care.
This process can be repeated if you don't feel it worked well the first time. You will have to clean the peg before that - grinding the grime off with sand should work fine or ideally some emery paper if you have it. If you don't clean it you won't see the soap turning black.
You can find more hand-on information about annealing of common metals here.
Careful: Don't burn yourself. The metal will be very hot. Don't touch it with your fingers and take care it can not accidentally fall on you.
Straightening the metal (1): Now you should be able to bend the peg back. The perfect tools for this job would be a sturdy pair of mole grips to hold the peg (but if you are careful your hand will do), a hammer and anvil. I know, if you had a blacksmith workshop at home you would not be asking this question. However for a thin piece of metal like aluminium you should be able to use the tools of our ancestors from the days before metal smelting was discovered and use stones. You'll want to pick a hammerstone that is comfortable in your hand. You want to start with an anvil stone with a bend only slightly less than the bend in your peg. Place the peg on the anvil stone so the inside of the bend points to the anvil. There should be some space between the peg and the anvil stone right in the middle of the bend but the two points where peg and anvil are touching should not be too far away from each other, maybe three quarters of an inch (for really tight bends) to two inches (for wider bends). Hit with the hammerstone the middle of the bend. Continue this while turning / exchanging the anvil stone to suit the bend until you end up with one that is almost flat. As a rule your next hit with the hammerstone should always go to the back of the middle of the bit that is bent the most.
This may sound a bit complicated when described in writing but once you get the hang of this, the details will make sense naturally and it is surprisingly simple to do. Your peg won't look like new obviously, but you will be surprised how straight you can get it with this method.
Careful: If you hit the peg with the hammerstone it will jump in your hand unless it was perfectly aligned and all the energy from the hit is dissipated by bending the metal back. If you happen to get this always right from the start consider a career as a blacksmith - you are a natural. If you don't it will hurt. If you have it, use a suitable pair of pliers. A molegrip would be ideal. You could also use a bit of fabric (or better, leather) wrapped around the peg to dissipate the shock of the impact. Don't try to hold the peg to tight. Allow it to jump. The hammer and anvil stones are supposed to take all the force from the hit, not your hand.
Straightening the metal (2): If you can find a hole in a metal fence or similar you could insert the peg to just before the bend. Then you could insert the other side of it in a pipe and use the leverage to bend the peg back. Sometimes it is quite hard to prevent the peg from spinning away and to keep it straight that way. Instead of a pipe you could use a spanner with a ring, or any other metal tool item with a hole where the other side of the peg can be inserted. To prevent the peg from spinning, put the tool on in a way that you pull it rather than push. This method is quicker to do if you can find the tools but the result is somewhat cruder. It is also more stressful for the metal - so it is more likely to break your peg.