I don't think this is guaranteed to work, as far as the standard is concerned. I don't think there is a way to do what you are asking that is not undefined behavior. Having said that, I am near certain that , in almost all cases (and probably in absolutely all cases that you care about), it will work.
uint8_t * ibegin = reinterpret_cast<uint8_t*>(&vec1[0]);
auto size = vec1.size() * (sizeof(float)/sizeof(uint8_t));
buffer.assign(ibegin, ibegin + size);
// Not sure what you wanted to do with vec2. Append it?
ibegin = reinterpret_cast<uint8_t*>(&vec2[0]);
size = vec2.size() * (sizeof(float)/sizeof(uint8_t));
buffer.insert(buffer.end(), ibegin, ibegin + size);