How does the work relation between Shichibukai and the World Government? Shichibukai are pirates who have allied themselves with the World Government. But how does it work between them? What are their rule between each other? All Shichibukai have a bounty, is that means if they got caught they still got punished? On Crocodile side, he work against the World Government, so the World Government sent him to jail. And Jinbe got jailed because he refuse to help the World Government to fight against Shirohige. But what if they didn't do anything wrong and someone able to defeat them and give them to the World Government? Are the World Government still punished them?
Shichibukai are famous pirates with large bounties who have joined with the marines. They help marines in tough situations and eliminate weak pirates. In return the World Government ignore their actions, business, etc.

As for the specific rules:


They have to pay specific amount (1/10) of their profit to the World Government regularly.
They will not indulge in any activity that will affect the peace of a country.
They will have to answer the call of the marines in tough situations.


In any case if any of the above rules is broken, the contract will be dissolved and their bounty will be re-activated.

For the second question, as long as the Shichibukai has not yet broken those rules, they will remain bonded with the World Government, thus the Marines will go after the group who defeated them.

Further information can be obtained from here.