It means something like "speaking frankly", "this might sound a bit harsh but…" or just "this is how I genuinely see the situation" etc.
Some typical contexts...
I know she tried hard to get this paella right but, to be honest, I've tasted better.
To be honest, I don't think John's as smart as he thinks he is.
I know you're a big fan but, to be honest, I don't like any of Johnny Depp's films.
They may or may not fire me for this. I don't care either way, to be honest.
Although the apology is welcome, to be honest, it's too little too late".
not a teacher
ps: pretty much what Barb says but with some examples.