If you receive a trademark opposition, the amount of time you will have to respond depends on the jurisdiction.
EU trademarks
If you receive a "Notice of Opposition", a period of 2 months follows, where both parties can contact one another and reach an amicable solution. This is an advised course of action, as both parties can work together on a resolution in a friendly manner. This is formally called a "Cooling off period". If an agreement is reached during this window so that no further actions from the EUIPO have to follow, neither party will be ordered to pay costs. On the other hand, if no agreement was reached during this period, the litigation part of the procedure begins.
UK trademarks
Once you receive a notification that a notice of threatened opposition was filed against your application, the Cooling off period starts. It lasts for nine months, extendable by further nine months if requested by both parties.
US trademarks
You will have 40 days to respond to the Notice of Opposition. If you miss this deadline, you can still try to submit your response, including the reason for being late, to the Trademark Trial and Appeal Board, which will evaluate your case.