The government is considering making it illegal for lawmakers to switch sides amid reports the opposition was trying to lure ruling party defectors, a minister said.