This is a way to apologize for a small mistake you made. When you make a larger mistake and want to apologize more strongly, you can say "I'm sorry for ___ing":

I'm sorry for making you wait so long.

But "I'm sorry for getting sidetracked" would sound strange, because getting sidetracked isn't what you're really sorry about. You're sorry for not answering the question quickly. So a more serious apology would be:

I'm sorry for taking so long.