If an employer terminates employment before the H1-B visa expires, the employer will be responsible for the cost of return travel.  If an employee voluntarily resigns before their visa expires, they will have to pay the cost of return travel.