Can I put vias on routing I2C lines traces on FR4 PCB?
At I2C speeds, vias will cause you absolutely no problems at all.

At least, no problems in terms of track resistance, capacitance or inductance. However, if you have a 2 layer board, then using both layers is best done systematically, otherwise you can lead yourself into problems.

What many people do is to dedicate one layer of a board to ground. This generally works well, UNTIL they start chopping the ground up with 'just one track' run on the other layer. When this track is joined by 'just another', and another, the ground ends up looking like a lace curtain. It doesn't do its job, and it's difficult to determine where and how to stitch it back together, especially if you're inexperienced. Even worse, some will route all the tracks, then do a 'copper pour', in the hope that this makes a good ground plane.

If you're using 2 layers for signals, then it's far better to start with a plan. Use a 'Manhattan' tracking arrangement, east-west on one layer, north-south on the other. Start with a 'gridded ground', put parallel tracks every 10mm or so, and via them at every intersection. This works almost as well as a ground plane, and at I2C speeds is absolutely as good. Now you have a systematic way to run a track from anywhere, to anywhere, and can hop to the other side of the board exactly where you need to, without disturbing the existing ground continuity.

An alternative is to use a ground plane, but to avoid chopping it up by staying on your signal layer for all signals. Cross tracks by passing tracks under components. You can buy 'zero ohm' resistors for this purpose, though a 1 or even 10 ohm resistor will be as good as a wire at I2C resistance levels.