It means to put one's life or career or reputation or feelings in danger or jeopardy. The idiom, I believe, comes from the practice of war. Soldiers were positioned between two lines: the enemy's line, which they faced, and the dead line, which was drawn in the dirt behind them. Soldiers crossing the enemy's line went into battle, and soliders crossing the dead line, or running away from the battle, were shot by their own men. That's why, being 'on the line' is considered to be a dangerous position to be in.