I am not 100% sure that there isn't any concurrency issue here, but I would start with a trigger like this:
CREATE TRIGGER ins_your_table BEFORE INSERT ON your_table
FOR EACH ROW
SET new.field1=case when new.field1 is null then
coalesce((select max(field1)+1 from your_table),1)
else new.field1 end
;
insert into your_table (field1, field2) values (10, 1),(11, 2),(12, 3);
select * from your_table;
| ID | FIELD1 | FIELD2 |
------------------------
| 1 | 10 | 1 |
| 2 | 11 | 2 |
| 3 | 12 | 3 |
delete from your_table;
insert into your_table (field1, field2) values (10, 1),(11, 2),(12, 3);
insert into your_table (field2) values (4),(5),(6);
select * from your_table;
| ID | FIELD1 | FIELD2 |
------------------------
| 1 | 10 | 1 |
| 2 | 11 | 2 |
| 3 | 12 | 3 |
| 4 | 13 | 4 |
| 5 | 14 | 5 |
| 6 | 15 | 6 |
See some examples on this fiddle.