Yes. Your companion may stay in your accommodation, attend your appointments if you wish and wait for you whilst you have your surgery. Your companion may nurse you in your recovery period or you may chose to contract nursing care or stay in a recovery center which has nursing care included.
However it is not vital to have a traveling companion. Many medical travellers come to Costa Rica alone, relying on the post-surgery services of the health provider, recovery center and contract nursing care should they require it.