Assuming 4" fitting, Get a 4' MIPT X 4"ABS glued adapter to screw in, a piece of 4" ABS pipe and a 4" FIPT X 4" ABS glued adapter, Screw the male adapter into the existing, cut the pipe to whatever length you want, glue the three pieces together and you have the extension you want.
This is assuming it is a 4" sewer pipe. If it is another size then use the correct size of these same parts.
Home Depot has them on their website, but a good hardware store or plumbing supply will carry them as well.
http://www.homedepot.com/p/4-in-ABS-DWV-Hub-x-MIPT-Male-Adapter-C5804HD4/100342725
http://www.homedepot.com/p/4-in-ABS-DWV-Hub-x-FIPT-Female-Adapter-C5803HD4/100346793
Could also be PVC Fittings.