Yes - It happens. Two of the pilots I've flown with here - 1) Did a boat tour and an MSST tour and then went to flight school. The other did a boat tour, then an boat XO tour, then flight school.
It is not a deal breaker, but (this is personal opinion developed from discussion with a wide variety of folks) it puts you at a bit of a timing disadvantage compared to others (direct to fliggth school and first toour to flight school) because the LCDR board is all at the same time and your pilot year group mates will be IP's and on a second tour and you will be an AC on your first tour. Totally do-able, but it might require a department head tour as you upgrade or just after upgrade to AC...which can be more stressful than the other new ACs at your unit have it. (That was total opinion and folks have done it, so it IS possible)