Muscle soreness is caused by a build-up of lactic acid in the muscles. Sometimes the pain is delayed, but usually the soreness tends to show up between 24-48 hours and is commonly called "DOMS" (delayed onset muscle soreness) after exercise.
Everyone gets it too. It's not unique to beginners or bodybuilders. Anyone who strains/rips their muscles is going to experience soreness either soon after or a delayed response. Sometimes the delay is caused by adrenaline and other pain-killing hormones in your system so you simply don't notice the pain until later. This is common for boxers for example who experience pain while fighting in the ring, but the real pain doesn't happen until after the match is over and they can barely stand due to all the pain.
Every time that you exercise and especially when you try new things such as exercises you've never done before, or trying heavier weights or by adding time to the routine, your muscles are simply not used to the demand. What happens is the tiny muscle fibers tear and break, and then they heal and fill in the muscle void with new muscle tissue so that you can handle that same load of work the next time with less effort and less pain. A little muscle soreness is a good thing. Hence the saying NO PAIN, NO GAIN. Muscle pain means that you have challenged your body and that it is now healing and building new muscle tissue.
Lets say you don't normally do situps and your core muscles aren't the greatest. So one day you do 300 situps and that night and the day after your abs hurt. But two days later if you try to do 300 situps again, it will be easier the 2nd time around and you will experience less pain. This is because you've healed and built up more muscle in that region during the healing process. If you kept doing 300 situps every 2 days for a month by the end of the month you would be experiencing almost no pain and your ab muscles would be significantly stronger.
So regardless of whether you are doing weightlifting or ab workouts or even cardio, you are going to experience muscle pain. Even archery causes muscle pain in your arms and back if you aren't used to the poundage of the bow.
So what can you do about it?
#1. Only exercise those same muscles every 2 days so you can rest and heal in-between and build up your strength/endurance.
#2. Don't overdo it on the weights. Make gradual improvements on how much weight you are lifting. I know its fun to try and lift your maximum amount, but I only recommend doing that once per month and then keeping a record of what your maximum was.
#3. Stretching / Yoga. Stretching and yoga can help prevent / decrease muscle soreness.
#4. Take a cold bath or shower when you experience muscle soreness. Its really cold, but it helps numb the pain.
#5. Eat lots of beans, nuts, etc after a workout. Or a protein shake or protein bar. The extra protein will help build/repair muscle tissue faster. I don't recommend meat because the protein content in meat isn't as high as people like to think it is. eg. Pork chops are only 18% protein.
#6. Do NOT exercise muscles that are already sore. They're trying to heal. Focus your workout on different muscles on days when your muscles are so. eg. Some people like to alternate weightlifting on one day with cardio on the next. Or alternatively upper body on one day and lower body on the next.
#7. As a last resort, pain killers. Pay attention and learn what is actually in them however. A common painkiller you can find in a pharmacy for bodybuilders is actually just Tylenol 650 mg - which is the same thing people take for arthritis pain. So if you do go that way, look at the prices because seniors pay less for arthritis pills than bodybuilders do for muscle relaxers, even though its the same ingredient.
Always remember that pain is temporary. The feeling of achieving your goals lasts forever.