The time for sex will come, but when that is depends on you and your partner, as well as your body. Some women feel like having sex again pretty much immediately after birth. Others are tired, feel physically weak, and are just too busy to find time to do the deed. Your partner may be eager to be close to you, or could be just as exhausted and focused on the new baby as you are. No matter whether you fall into the "want to try sex again now" or the "can't even thinking about doing it" category, it is a good idea to give your body a rest until you feel you have mostly recovered from the tremendous act of giving birth.
When you do try again for the first time, make sure that you take things slowly. You could experience some pain, not just because you are recently postpartum but also because your hormones are different now, and your vagina could be a little dry (especially for nursing mothers). If you experienced vaginal tears or an episiotomy, you should give those time to heal first, as the stitches can tear open again. It is also possible that the "birth canal" will still be stretched quite a bit if you delivered your baby vaginally and have intercourse soon after the birth. If the first time after giving birth is not pleasant, don't panic.
Simply note that your body wasn't ready after all, and try again a few days or a week later. You can start doing Kegel exercises to increase the strength in your pelvic floor muscles and encourage the healing process, and enjoy some gentle massaging and snuggling while you recover.