The firm could face fines “running into millions of pounds” if found guilty, Boris Johnson told the House of Commons.
It came as the boss of P&O Ferries apologised for the mass sacking.
Peter Hebblethwaite said the decision was “incredibly difficult” but “the only way to save the business”.
The sackings – along with claims that workers paid as little as £1.81 an hour will replace the fired staff – have sparked outrage.
At Prime Minister’s Questions, Mr Johnson said: “Under section 194 of the trades union and labour relations act of 1992, it looks to me as though the company concerned has broken the law.
“And we will be taking action therefore, and we will be encouraging workers themselves to take action under the 1996 employment rights act.”
He added that the government would take steps to protect mariners working in UK waters and “ensure they all paid the living wage”.
Responding, Labour leader Sir Keir Starmer said it was not illegal for international seafarers to be paid below the national living wage at UK ports and criticised the government for not banning the practice.
He added that the government should immediately cancel a £50m contract awarded to P&O Ferries’ owner, DP World. Ministers have said such contracts are under review.
“DP World must be quaking in their boots. The prime minister says how disappointed he is in them whilst handing them £50m,” Mr Starmer said.
P&O denies it broke the law and says it is compensating workers fairly. But on Wednesday Mr Hebblethwaite said he understood people’s anger.
“I want to say sorry to the people affected and their families for the impact it’s had on them, and also to the 2,200 people who still work for P&O and will have been asked a lot of difficult questions about this,” he said.
“Over the last week, I’ve been speaking face-to-face to seafarers and their partners. They’ve lost their jobs and there is anger and shock and I completely understand.”
He added that the sackings were necessary to keep the loss-making firm afloat.
“This was an incredibly difficult decision that we wrestled with but once we knew it was the only way to save the business, we had to act,” Mr Hebblethwaite said.
“I wish there was another way and I’m sorry.”
It comes after reports that Indian agency workers paid as little as £1.81 an hour have already replaced sacked P&O workers at the Port of Dover.
Last week P&O said the figure was inaccurate but said it could not comment on how much agencies pay workers on ferries.
Some of P&O’s ferries are registered in Cyprus, meaning they do not have to pay the minimum wage required by UK law.